public DataRespond updateChiBo(ChiBoRequest cb) { DataRespond data = new DataRespond(); try { ChiBo chb = m_chiBoResponsitory.getChiBoById(cb.cbid); chb.cbid = cb.cbid; chb.tencb = cb.tencb; chb.dbid = cb.dbid; chb.active = cb.active == 0 ? true : false; DateTime ngaytl = DateTime.ParseExact(cb.ngaythanhlap, "dd/MM/yyyy", CultureInfo.InvariantCulture); chb.ngaythanhlap = ngaytl; data.success = true; m_chiBoResponsitory.updateChiBo(chb); } catch (Exception e) { data.success = false; data.error = e; data.message = e.Message; } return(data); }
public DataRespond insertChiBo([FromBody] ChiBoRequest cb) { DataRespond data = new DataRespond(); try { ChiBo chb = new ChiBo(); chb.tencb = cb.tencb; chb.dbid = cb.dbid; chb.active = cb.active == 0 ? true : false; DateTime ngaytl = DateTime.ParseExact(cb.ngaythanhlap, "dd/MM/yyyy", CultureInfo.InvariantCulture); chb.ngaythanhlap = ngaytl; chb.createday = DateTime.Now; data.success = true; m_chiBoResponsitory.insertChoBo(chb); data.message = "Insert success!"; } catch (Exception e) { data.success = false; data.error = e; data.message = e.Message; } return(data); }