Ejemplo n.º 1
0
        public async Task <IActionResult> EditTask(TaskModel request)
        {
            if (ModelState.IsValid)
            {
                var result = await _WorkSVC.UpdateTask(request, User);

                if (!result)
                {
                    ViewBag.ErrorMessage = "ไม่สามารถแก้ไขข้อมูลงานย่อยได้ กรุณาตรวจสอบข้อมูล";
                    var qry = await _membershipSVC.GetMemberships(request.Project_id);

                    ViewBag.AssignmentList = qry.Select(it => it.MemberUserName);
                    return(View(request));
                }
                return(RedirectToAction(nameof(Detail), new { id = request.Project_id }));
            }
            else
            {
                ViewBag.ErrorMessage = "ไม่สามารถแก้ไขข้อมูลงานย่อยได้ กรุณาตรวจสอบข้อมูล";
                var qry = await _membershipSVC.GetMemberships(request.Project_id);

                ViewBag.AssignmentList = qry.Select(it => it.MemberUserName);
                return(View(request));
            }
        }