public IHttpActionResult TickRequest(string IDRequest, string IDEquipment, string IDEmployee)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest("invalid request"));
     }
     using (var context = new EquipmentEntities())
     {
         try
         {
             var result = context.ASSIGN_TO_EMPLOYEE(IDEquipment, IDEmployee);
             if (result == 1)
             {
                 var tick = context.TICK_REQUEST(IDRequest);
                 if (tick == 1)
                 {
                     return(Ok("success"));
                 }
                 else
                 {
                     return(BadRequest("tick error with request record"));
                 }
             }
             return(BadRequest("Server error"));
         }
         catch (Exception ex)
         {
             return(BadRequest(ex.Message));
         }
     }
 }
 public IHttpActionResult AssignToEmp([FromBody] AssignModel model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest("invalid request"));
     }
     using (var context = new EquipmentEntities())
     {
         var equip = context.EQUIPMENTs.Where(s => s.ID == model.IDEquip).FirstOrDefault();
         var emp   = context.AspNetUsers.Where(s => s.UserName == model.UserName).FirstOrDefault();
         if (equip == null || emp == null)
         {
             return(NotFound());
         }
         var result = context.ASSIGN_TO_EMPLOYEE(model.IDEquip, model.UserName);
         if (result == 1)
         {
             return(Ok());
         }
         else
         {
             return(BadRequest("Server Error"));
         }
     }
 }