示例#1
0
        public IActionResult ViewWork(WorkEditView model)
        {
            List <UserPhasesViewModel> lst = new List <UserPhasesViewModel>();

            if (model.WorkPhases != null)
            {
                foreach (Phase phase in model.WorkPhases)
                {
                    if (phase.EmployeeId.ToString() == userManager.GetUserId(User))
                    {
                        UserPhasesViewModel userPhasesViewModel = new UserPhasesViewModel
                        {
                            PhaseId  = phase.PhaseId,
                            IsFinish = phase.IsFinish,
                        };
                        lst.Add(userPhasesViewModel);
                    }
                }

                var rs = phaseDL.UpdatePhasesStatus(lst);
                if (!rs)
                {
                    TempData["Error"] = "Có lỗi xảy ra !";
                }
            }

            return(RedirectToAction("ViewWork", new { workId = model.WorkId }));
        }
        public IActionResult EditWork(WorkEditView pro)
        {
            if (ModelState.IsValid)
            {
                var rs = workDL.EditWork(pro);
                if (rs)
                {
                    return(RedirectToAction("ListWorks", "Home"));
                }

                ModelState.AddModelError("", "Sửa thông tin dự án không thành công");
            }
            return(View());
        }