public IActionResult Get(Guid id)
 {
     try
     {
         using (var db = new AllInOneContext.AllInOneContext())
         {
             ShiftHandoverLog data = db.ShiftHandoverLog
                                     .Include(t => t.OffGoing)
                                     .Include(t => t.OnComing)
                                     .Include(t => t.Organization)
                                     .Include(t => t.Status)
                                     .FirstOrDefault(p => p.ShiftHandoverLogId.Equals(id));
             if (data == null)
             {
                 return(NoContent());
             }
             return(new ObjectResult(data));
         }
     }
     catch (Exception ex)
     {
         return(BadRequest(new ApplicationException {
             ErrorCode = "Unknown", ErrorMessage = ex.Message
         }));
     }
 }
 public IActionResult Update([FromBody] ShiftHandoverLog model)
 {
     try
     {
         if (model == null)
         {
             return(BadRequest());
         }
         using (var db = new AllInOneContext.AllInOneContext())
         {
             db.ShiftHandoverLog.Update(model);
             db.SaveChanges();
             return(new NoContentResult());
         }
     }
     catch (DbUpdateException dbEx)
     {
         return(BadRequest(new ApplicationException {
             ErrorCode = "DBUpdate", ErrorMessage = "数据保存异常:" + dbEx.Message
         }));
     }
     catch (System.Exception ex)
     {
         return(BadRequest(new ApplicationException {
             ErrorCode = "Unknown", ErrorMessage = ex.Message
         }));
     }
 }
 public IActionResult Delete(Guid id)
 {
     try
     {
         using (var db = new AllInOneContext.AllInOneContext())
         {
             ShiftHandoverLog data = db.ShiftHandoverLog.FirstOrDefault(p => p.ShiftHandoverLogId == id);
             if (data == null)
             {
                 return(NoContent());
             }
             db.ShiftHandoverLog.Remove(data);
             db.SaveChanges();
             return(new NoContentResult());
         }
     }
     catch (System.Exception ex)
     {
         return(BadRequest(new ApplicationException {
             ErrorCode = "Unknown", ErrorMessage = ex.Message
         }));
     }
 }