Beispiel #1
0
 public ActionResult EditEmployee(Employee employee)
 {
     if (ModelState.IsValid)
     {
         dbContext.Entry(employee).State = EntityState.Modified;
         dbContext.SaveChanges();
         return(RedirectToAction("PageManager"));
     }
     return(View(employee));
 }
Beispiel #2
0
        public async Task <IActionResult> PutWorker(int id, WorkerDto workerDto)
        {
            var worker = _mapper.Map <Worker>(workerDto);

            if (id != worker.WorkerId)
            {
                return(BadRequest());
            }

            _context.Entry(worker).State = EntityState.Modified;


            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WorkerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #3
0
        public async Task <IActionResult> PutAssignment(int id, AssignmentDto assignmentDto)
        {
            var assignment = _mapper.Map <Assignment>(assignmentDto);

            if (id != assignment.AssignmentId)
            {
                return(BadRequest());
            }


            _context.Entry(assignment).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AssignmentExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutProject(int id, RoleDto role)
        {
            if (id != role.RoleId)
            {
                return(BadRequest());
            }

            _context.Entry(role).State = EntityState.Modified;


            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProjectExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Beispiel #5
0
        public ActionResult ManagerEdit(ManagerDetails manager)
        {
            var db    = new ManagerDbContext();
            var user  = db.Managers.Find(manager.ID);
            var entry = db.Entry(manager);

            if (ModelState.IsValid)
            {
                manager.RoleID = 2;

                entry.State = EntityState.Modified;
                db.Entry(user).Property("ConfirmPassword").IsModified = false;
                db.SaveChanges();
                return(RedirectToAction("Managers", "Admin"));
            }
            return(View(entry));
        }