Exemple #1
0
        // GET: Module/Edit/5
        public async Task <ActionResult> Edit(int id)
        {
            var module = await _moduleBus.GetById(id);

            ViewBag.Users = await _projectBus.GetUserNotWatcher(module.ProjectId);

            ViewBag.GetSoftRole = await _jobRoleBUS.GetSoftRole();

            ViewBag.Members = JsonConvert.SerializeObject(module.GetMemberParams());
            return(View(module));
        }
Exemple #2
0
        public async Task <ActionResult> Edit(Module module, string members)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var listMembers = JsonConvert.DeserializeObject <List <MemberParamsViewModel> >(members);
                    var result      = await _moduleBus.Update(module, listMembers, errors);

                    if (result)
                    {
                        TempData["isSuccess"] = true;
                        return(RedirectToAction("Index", "Module", new { id = module.ProjectId }));
                    }
                }

                _moduleBus = new ModuleBUS();
                var originalModule = await _moduleBus.GetById(module.Id);

                ViewBag.Users = await _projectBus.GetUserNotWatcher(module.ProjectId);

                ViewBag.GetSoftRole = await _jobRoleBUS.GetSoftRole();

                ViewBag.InsertFailed = true;
                ViewBag.Members      = JsonConvert.SerializeObject(originalModule.GetMemberParams());
                return(View(originalModule));
            }
            catch
            {
                _moduleBus = new ModuleBUS();
                var originalModule = await _moduleBus.GetById(module.Id);

                ViewBag.Users = await _projectBus.GetUserNotWatcher(module.ProjectId);

                ViewBag.GetSoftRole = await _jobRoleBUS.GetSoftRole();

                ViewBag.InsertFailed = true;
                ViewBag.Members      = JsonConvert.SerializeObject(originalModule.GetMemberParams());
                return(View(originalModule));
            }
        }