0

I have created a list of project in CRUD operation, in which I have successfully created a list of projects with uploading attachment. My problem is that when I update the project list. I am unable to read the inserted file and unable to upload the attachment file.

Businees Access Layer Code is

public bool UpdateProject(ProjectInfoModel upd)
    {
        try
        {
            int ProjectID = upd.ProjectID;
            string ProjectCode = upd.ProjectCode;
            string ProjectName = upd.ProjectName;
            int ProjectTechnologiesID = upd.ProjectTechnologiesID;
            int ProjectEngagementModelID = upd.ProjectEngagementModelID;
            int ClientID = upd.ClientID;
            DateTime ProjectStartDate = upd.ProjectStartDate;
            DateTime ProjectEndDate = upd.ProjectEndDate;
            string Remarks = upd.Remarks;
            DateTime CreatedDateTime = upd.CreatedDateTime;
            int CreatedBy = upd.CreatedBy;
            int LastModifiedBy = upd.LastModifiedBy;
            DateTime LastModifiedDateTime = upd.LastModifiedDateTime;
            string ProjectStatus = upd.ProjectStatus;

            int ProjectLeadID = upd.ProjectLeadID;
            int AccountManagerID = upd.AccountManagerID;

            // below code for stored procedure

            DB.ProjectUpdate(ProjectID, ProjectCode, ProjectName, ProjectTechnologiesID, ProjectEngagementModelID, ClientID, ProjectStartDate, ProjectEndDate, Remarks, CreatedDateTime, CreatedBy, LastModifiedBy, LastModifiedDateTime, ProjectStatus, ProjectLeadID, AccountManagerID);   



       }
        catch (Exception e)
        {


        }
        return true;
    }

Controller code is


public ActionResult UpdateProject(string id)
    {
       ProjectInfoModel pm = new ProjectInfoModel();

        try
        {
            pm = objPMSBAL.getproject(Convert.ToInt32(id));
            ViewBag.ClientID = new SelectList(objPMSBAL.ListClientId(), "ClientID", "ClientID");
            ViewBag.ProjectEngagementModelID = new SelectList(objPMSBAL.ListEngagementId(), "ProjectEngagementModelID", "ProjectEngagementModelID");
            ViewBag.ResourceID = new SelectList(objPMSBAL.ListResourceId(), "ResourceID", "ResourceID");
            ViewBag.TechnologyID = new SelectList(objPMSBAL.ListTechnologyId(), "ProjectTechID", "ProjectTechID");

        }

        catch (Exception e)
        {


        }
        return View(pm);


    }


    [HttpPost]
    public ActionResult UpdateProject(ProjectInfoModel UP)
    {
        if (ModelState.IsValid)
        {


           objPMSBAL.UpdateProject(UP);       // Calling BAL method


        }

        return RedirectToAction("ProjectList1");
    }

So I need help to solve my problem. Thank you in advance.

  • 2
    Please explain _"unable to read the inserted file and unable to upload the attachment file"_. What is the actual problem? What have you tried? – CodeCaster Mar 06 '14 at 12:13
  • I have first insert the project data with an attach file and when I update or edit the data then the code and attached file not able to read. – user3319070 Mar 06 '14 at 12:25
  • What is _"not able to read"_? Do you not know what code to write, or does the existing code give any compile-time errors, or throw exceptions at runtime? – CodeCaster Mar 06 '14 at 12:25
  • I want some code or tutorial about uploading the file and editing. Pls If u have and suggested site. – user3319070 Mar 06 '14 at 12:30
  • Try to search the web for "asp.net mvc file upload", which will lead you to [Uploading a File (Or Files) With ASP.NET MVC](http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx/). – CodeCaster Mar 06 '14 at 12:31
  • possible duplicate of [File Upload ASP.NET MVC 3.0](http://stackoverflow.com/questions/5193842/file-upload-asp-net-mvc-3-0) – CodeCaster Mar 06 '14 at 12:34

0 Answers0