public Participant UpdateOutput(Participant model) { using (OVODEntities db = new OVODEntities()) { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(model); } }
public IHttpActionResult PostHD_HRPAYADJ(HD_HRPAYADJ DT_HRPAYADJ) { try { if (DT_HRPAYADJ.PA_ID == 0) { DB.HD_HRPAYADJ.Add(DT_HRPAYADJ); } else { //DB.Entry(DT_HRPAYADJ).State = EntityState.Modified; DB.Set <HD_HRPAYADJ>().AddOrUpdate(DT_HRPAYADJ); } foreach (var item in DT_HRPAYADJ.DT_HRPAYADJ) { if (item.PAD_ID == 0) { DB.DT_HRPAYADJ.Add(item); } else { DB.Entry(item).State = EntityState.Modified; } } foreach (var id in DT_HRPAYADJ.DeletedPayAdjdIds.Split(',').Where(x => x != "")) { DT_HRPAYADJ x = DB.DT_HRPAYADJ.Find(Convert.ToInt64(id)); DB.DT_HRPAYADJ.Remove(x); } DB.SaveChanges(); //return CreatedAtRoute("DefaultApi", new { id = DT_HRPAYADJ.PA_ID }, DT_HRPAYADJ); return(Ok()); } catch (Exception ex) { throw ex; } }
public HttpResponseMessage TTList([FromBody] TTMAST tTMAST) { try { using (OVODEntities db = new OVODEntities()) { if (tTMAST.TT_ID == 0) { db.TTMASTs.Add(tTMAST); db.SaveChanges(); } else { db.Entry(tTMAST).State = EntityState.Modified; db.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.Created)); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }