Exemple #1
0
        public async Task <IActionResult> Solved([Bind("ID,SolvedDate,SolvedDescription")] SolvedViewModel solvedViewModel)
        {
            if (solvedViewModel.ID == null)
            {
                return(NotFound());
            }

            var complain = await _context.Complains.FindAsync(solvedViewModel.ID);

            if (complain == null)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    complain.Status            = "Solved";
                    complain.SolvedDate        = solvedViewModel.SolvedDate;
                    complain.SolvedDescription = solvedViewModel.SolvedDescription;

                    _context.Update(complain);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    throw;
                }

                return(RedirectToAction(nameof(Assigned)));
            }

            return(View(solvedViewModel));
        }
Exemple #2
0
        public async Task <IActionResult> Solved(int id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var complain = await _context.Complains.FindAsync(id);

            if (complain == null)
            {
                return(NotFound());
            }

            if (HttpContext.Session.GetString("UserWorker") != null)
            {
                SolvedViewModel solvedViewModel = new SolvedViewModel
                {
                    ID = id
                };

                return(View(solvedViewModel));
            }
            else
            {
                return(RedirectToAction("Worker", "Account"));
            }
        }