public static WorkingBreakDTM changeToDTM(WorkingBreak workingBreak) { WorkingBreakDTM workingBreakDTM = new WorkingBreakDTM(); workingBreakDTM.Id = workingBreak.Id; workingBreakDTM.WeekDay = workingBreak.WeekDay; workingBreakDTM.BreakStart = workingBreak.BreakStart; workingBreakDTM.BreakStop = workingBreak.BreakStop; return(workingBreakDTM); }
// POST: api/WorkingBreaks/workingBreaksDTM public async Task <HttpResponseMessage> Post([FromBody] WorkingBreakDTM workingBreakDtm) { try { int id = await TheRepo.WorkingBreaksDTM.Create(workingBreakDtm); return(Request.CreateResponse(HttpStatusCode.Created, id)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public async Task <HttpResponseMessage> Put([FromBody] WorkingBreakDTM workingBreakDtm) { try { var originalWBreak = TheRepo.BusinessesDTM.Get(workingBreakDtm.Id); if (originalWBreak == null) { return(Request.CreateResponse(HttpStatusCode.NotModified, "Item is not found")); } else { await TheRepo.WorkingBreaksDTM.Update(workingBreakDtm); return(Request.CreateResponse(HttpStatusCode.OK, workingBreakDtm)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }