Esempio n. 1
0
        public ActionResult UpdatePresentence(PCMPresentenceDetailsViewModel VM)
        {
            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 intassid = Convert.ToInt32(Session["IntakeassId"]);
            int idcreate = Convert.ToInt32(Session["presentadd"]);

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

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

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

            // Call Update Function
            Model.UpdatePresentence(VM, userId, Id);
            ViewBag.Message = "Updated successfully";

            //return View("UpdatePCMCase", caseVM);
            return(RedirectToAction("IndexPre", "Assessment", new { Id = intassid }));
        }