public object Save([FromBody] Cooperate cooperate) { try { EFHelper <Cooperate> eFHelper = new EFHelper <Cooperate>(); eFHelper.Add(cooperate); return(new NewErrorModel() { error = new Error(0, "保存成功!", "") { }, }); } catch (Exception ex) { throw ex; } }
public object Modify([FromBody] Cooperate cooperate) { try { using (DDContext context = new DDContext()) { context.Entry <Cooperate>(cooperate).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } return(new NewErrorModel() { error = new Error(0, "修改成功!", "") { }, }); } catch (Exception ex) { throw ex; } }
public object Read(string taskId) { try { EFHelper <Cooperate> eFHelper = new EFHelper <Cooperate>(); Cooperate cooperate = eFHelper.GetListBy(t => t.TaskId == taskId).FirstOrDefault(); return(new NewErrorModel() { count = 1, data = cooperate, error = new Error(0, "读取成功!", "") { }, }); } catch (Exception ex) { throw ex; } }