public ActionResult ManuscriptLogin(ManuscriptLoginVM manuscriptLoginVm, HttpPostedFileBase manuscriptFilePath) { manuscriptLoginVm.MSID = manuscriptLoginVm.MSID.Trim(); IDictionary <string, string> dataErrors = new Dictionary <string, string>(); if (!String.IsNullOrEmpty(manuscriptLoginVm.Associate)) { var empInfo = _manuscriptDBRepositoryReadSide.GetAssociateName(manuscriptLoginVm.Associate); if (empInfo.Count() > 0) { manuscriptLoginVm.userID = empInfo.FirstOrDefault().UserID; } } if (manuscriptLoginVm.CrestId == 0) { if (manuscriptLoginVm.IsRevision) { //SaveTempFileOnIISServer(manuscriptLoginVm, manuscriptFilePath); AddManuscriptLoginInfo(manuscriptLoginVm, dataErrors); } else { if (!ManuscriptLoginDbRepositoryReadSide.IsMSIDAvailable(manuscriptLoginVm.MSID, manuscriptLoginVm.CrestId)) { TempData["MSIDError"] = "<script>alert('Manuscript Number is already present.');</script>"; } else { //SaveTempFileOnIISServer(manuscriptLoginVm, manuscriptFilePath); AddManuscriptLoginInfo(manuscriptLoginVm, dataErrors); } } } else { if (manuscriptLoginVm.IsRevision) { //SaveTempFileOnIISServer(manuscriptLoginVm, manuscriptFilePath); AddManuscriptLoginInfo(manuscriptLoginVm, dataErrors); } else { if (ManuscriptLoginDbRepositoryReadSide.IsMSIDAvailable(manuscriptLoginVm.MSID, manuscriptLoginVm.CrestId)) { TempData["MSIDError"] = "<script>alert('Manuscript Number is already present.');</script>"; } else { var manuscriptLogin = new ManuscriptLogin(); manuscriptLogin = ManuscriptLoginDbRepositoryReadSide.GetManuscriptByCrestID(manuscriptLoginVm.CrestId); //code to updated record _manuscriptLoginService.SaveManuscriptLoginVM(dataErrors, manuscriptLoginVm, manuscriptLogin); TempData["msg"] = "<script>alert('Record updated succesfully');</script>"; } } } return(RedirectToAction("ManuscriptLogin", new { id = 0 })); }