public DataRespond insertDangBo(DangBoRequest db) { DataRespond data = new DataRespond(); try { DangBo dangbo = new DangBo(); dangbo.tendb = db.tendb; dangbo.active = db.active == 0 ? true : false; dangbo.tructhuoc = db.tructhuoc; DateTime ngaytl = DateTime.ParseExact(db.ngaythanhlap, "dd/MM/yyyy", CultureInfo.InvariantCulture); dangbo.ngaythanhlap = ngaytl; dangbo.createday = DateTime.Now; data.success = true; m_dangBoResponsitory.insertDangBo(dangbo); } catch (Exception e) { data.success = false; data.data = e; data.message = e.Message; } return(data); }
public DataRespond updateDangBo([FromBody] DangBoRequest db) { DataRespond data = new DataRespond(); try { DangBo dangbo = m_dangBoResponsitory.getDangBoById(db.dbid); dangbo.dbid = db.dbid; dangbo.tendb = db.tendb; dangbo.active = db.active == 0 ? true : false; dangbo.tructhuoc = db.tructhuoc; DateTime ngaytl = DateTime.ParseExact(db.ngaythanhlap, "dd/MM/yyyy", CultureInfo.InvariantCulture); dangbo.ngaythanhlap = ngaytl; data.success = true; m_dangBoResponsitory.updateDangBo(dangbo); } catch (Exception e) { data.success = false; data.data = e; data.message = e.Message; } return(data); }