コード例 #1
0
        public ActionResult UpdatePresentenceSummaries(PCMPresentenceDetailsViewModel caseVM)
        {
            var currentUser  = (User)Session["CurrentUser"];
            var userProvince = -1;
            var userId       = 0;

            if (currentUser != null)
            {
                userId = currentUser.User_Id;
                if (currentUser.Employees.Any())
                {
                    userProvince = currentUser.Employees.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
                if (currentUser.apl_Social_Worker.Any())
                {
                    userProvince = currentUser.apl_Social_Worker.First().apl_Service_Office.apl_Local_Municipality.District.Province_Id;
                }
            }
            int id       = Convert.ToInt32(Session["IntakeassId"]);
            int idcreate = Convert.ToInt32(Session["NewId"]);

            int Idupdate = Convert.ToInt32(Session["Idc1"]);
            int Id;

            if (Idupdate != 0)
            {
                Id = Idupdate;
            }
            else
            {
                Id = idcreate;
            }

            //instanciate model repositry
            PCMPresentenceModel Model = new PCMPresentenceModel();

            if (ModelState.IsValid)
            {
                // Call Update Function
                Model.UpdatePresentenceSummaries(caseVM, userId, Id);
                ViewBag.Message = "Updated successfully";
            }
            else
            {
                ViewBag.Message = "not updated ";
            }
            //return View("UpdatePCMCase", caseVM);
            return(RedirectToAction("IndexPre", "Assessment", new { Id = id }));
        }