public ActionResult EditPartial(DesignMaster designmastr) { var designData = _DesignService.GetById(designmastr.DesignId); //designData.CategoryCode = designmastr.CategoryCode; designData.CategoryCode = _ItemCategoryService.GetCodeByName(designmastr.CategoryCode); designData.SubCategoryName = designmastr.SubCategoryName; designData.DesignCode = designmastr.DesignCode; designData.DesignDescription = designmastr.DesignDescription; designData.DesignId = designmastr.DesignId; designData.DesignName = designmastr.DesignName; //designData.DesignSize = designmastr.DesignSize; designData.DesignPhoto = designmastr.DesignPhoto; if (designmastr.DesignPhoto == null && TempData["DesignPhotoName"] == null) { designData.DesignPhoto = null; } else if (designmastr.DesignPhoto != null) { designData.DesignPhoto = designmastr.DesignPhoto; } else { designData.DesignPhoto = TempData["DesignPhotoName"].ToString(); } designData.Status = "Active"; designData.ModifiedOn = DateTime.Now; _DesignService.UpdateDesign(designData); if (Request.Files.Count != 0) { HttpPostedFileBase fileField = Request.Files[0]; if (fileField != null) { var fileName = Path.GetFileName(fileField.FileName); System.IO.File.Delete(ConfigurationManager.AppSettings["DesignPhotos"].ToString() + "/" + designmastr.DesignPhoto); var path = ConfigurationManager.AppSettings["DesignPhotos"].ToString() + "/" + fileName; fileField.SaveAs(path); } } return(RedirectToAction("UpdateDetails/" + designmastr.DesignId, "Design")); }