public void DeleteCustomPaycheck(CustomPaycheck custompaycheck) { if (custompaycheck == null) { throw new ArgumentException("custompaycheck is null."); } this.context.AddUpdateDeleteCustomPaycheck(null, null, custompaycheck); }
public CustomPaycheck GetCustomPaycheck(int id) { CustomPaycheck item = null; using (var context = new PBEntities()) { item = context.CustomPaychecks.Where(s => s.Id == id).FirstOrDefault(); } return(item); }
public HttpResponseMessage UpdateCustomPaycheck(CustomPaycheck custompaycheck) { if (custompaycheck == null) { throw new ArgumentException("custompaycheck is null."); } if (ModelState.IsValid) { this.context.AddUpdateDeleteCustomPaycheck(null, null, custompaycheck); return(Request.CreateResponse(HttpStatusCode.OK)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } }
public HttpResponseMessage CreateCustomPaycheck(CustomPaycheck custompaycheck) { CustomPaycheck tempItem = new CustomPaycheck(); if (custompaycheck == null) { throw new ArgumentException("custompaycheck is null."); } if (ModelState.IsValid) { tempItem = this.context.AddUpdateDeleteCustomPaycheck(custompaycheck, null, null); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, tempItem); response.Headers.Location = new Uri(this.Request.RequestUri.AbsoluteUri + "/" + tempItem.Id); return(response); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } }
public CustomPaycheck AddUpdateDeleteCustomPaycheck(CustomPaycheck AddItem, CustomPaycheck UpdateItem, CustomPaycheck DeleteItem) { if (AddItem != null) { CustomPaycheck newItem = this.uow.CustomPaycheckRepository.Insert(AddItem); this.uow.Save(); return(newItem); } if (UpdateItem != null) { this.uow.CustomPaycheckRepository.Update(UpdateItem); } if (DeleteItem != null) { this.uow.CustomPaycheckRepository.Delete(DeleteItem); } this.uow.Save(); return(null); }