public IHttpActionResult AddAccountAt(int id, EmployeeAccountDto employeeAccount) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != employeeAccount.EmployeeAccountId) { return(BadRequest()); } try { accountRepo.Update(Mapper.Map <EmployeeAccount>(employeeAccount)); } catch (DbUpdateConcurrencyException) { if (!EmployeeAccountExists(id)) { return(Content(HttpStatusCode.NotFound, "Item does not exist")); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult AddEmployeeAccount(int employeeID, EmployeeAccountDto employeeAccount) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } accountRepo.Insert(Mapper.Map <EmployeeAccount>(employeeAccount)); return(CreatedAtRoute("AddEmployeeAccount", new { id = employeeAccount.EmployeeAccountId }, employeeAccount)); }