public IHttpActionResult PutWorkitemMT(TB_Workitem workitem) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { TB_Workitem objWork = new TB_Workitem(); objWork = objEntity.TB_Workitem.Find(workitem.ID); if (objWork != null) { objWork.ID = workitem.ID; objWork.Tipo = workitem.Tipo; objWork.Titulo = workitem.Titulo; objWork.DataCriacao = workitem.DataCriacao; } int i = this.objEntity.SaveChanges(); } catch (Exception) { throw; } return(Ok(workitem)); }
public IHttpActionResult DeleteWorkitemDL(int id) { TB_Workitem workitem = objEntity.TB_Workitem.Find(id); if (workitem == null) { return(NotFound()); } objEntity.TB_Workitem.Remove(workitem); objEntity.SaveChanges(); return(Ok(workitem)); }
public IHttpActionResult PostWorkitem(TB_Workitem data) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { objEntity.TB_Workitem.Add(data); objEntity.SaveChanges(); } catch (Exception) { throw; } return(Ok(data)); }
public IHttpActionResult GetWorkitemId(string workitemId) { TB_Workitem objWork = new TB_Workitem(); int ID = Convert.ToInt32(workitemId); try { objWork = objEntity.TB_Workitem.Find(ID); if (objWork == null) { return(NotFound()); } } catch (Exception) { throw; } return(Ok(objWork)); }