Exemple #1
0
        public async Task <ActionResult> Edit([Bind(Include = "Id,ProjectId,Topic,Type,Priority,UserId")] UsersTask usersTask)
        {
            if (ModelState.IsValid)
            {
                await _userTaskService.Update(usersTask);

                return(RedirectToAction("Index"));
            }
            _logger.Warn("Edit(). Validation error during task updating.");
            ViewBag.ProjectId = new SelectList(await _projectService.GetAll(), "Id", "Name", usersTask.ProjectId);
            ViewBag.UserId    = new SelectList(await _userService.GetAll(), "Id", "UserLogin", usersTask.UserId);
            return(View(usersTask));
        }
Exemple #2
0
        // GET: Details
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                _logger.Error("Error receiving Details() of task. id == null");
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UsersTask usersTask = await _userTaskService.Get((int)id);

            if (usersTask == null)
            {
                _logger.Error("Error receiving Details() of task. The task is not found");
                return(HttpNotFound());
            }
            return(View(usersTask));
        }
Exemple #3
0
        // GET: Edit
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                _logger.Error("Error receiving Edit() of task. id == null");
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UsersTask usersTask = await _userTaskService.Get((int)id);

            if (usersTask == null)
            {
                _logger.Error("Error receiving Edit() of task. The task is not found");
                return(HttpNotFound());
            }
            ViewBag.ProjectId = new SelectList(await _projectService.GetAll(), "Id", "Name", usersTask.ProjectId);
            ViewBag.UserId    = new SelectList(await _userService.GetAll(), "Id", "UserLogin", usersTask.UserId);
            return(View(usersTask));
        }