Beispiel #1
0
        public ActionResult Delete(int?ID)
        {
            if (ID == null)
            {
                return(BadRequest("The Request of Employee is Wrong"));
            }
            Employees employees = EmployeesRepostiry.Get(ID.Value);

            if (employees != null)
            {
                return(NotFound("The Employees not found"));
            }
            EmployeesRepostiry.Delete(employees);
            EmployeesRepostiry.SaveAll();
            return(NoContent());
        }
Beispiel #2
0
 public ActionResult <Employees> PutEmployees(int?ID, EmployeesEditViewModel viewModel)
 {
     if (ID == null)
     {
         return(BadRequest("The ID is not Found in Request"));
     }
     if (ModelState.IsValid)
     {
         try
         {
             Employees employees = EmployeesRepostiry.Get(ID.Value);
             Mapper.Map <EmployeesEditViewModel, Employees>(viewModel, employees);
             EmployeesRepostiry.Edit(employees);
             EmployeesRepostiry.SaveAll();
             return(Ok());
         }
         catch (DBConcurrencyException)
         {
             return(Conflict());
         }
     }
     return(BadRequest("Error Employees Data is Not valid"));
 }