public DataRespond insertDescipline(DisciplineRequest disrq) { DataRespond data = new DataRespond(); try { Discipline dis = new Discipline(); dis.fileid = disrq.fileid; dis.noidung = disrq.noidung; dis.donvi = disrq.donvi; DateTime timediscipline = DateTime.ParseExact(disrq.daycreate, "dd/MM/yyyy", CultureInfo.InvariantCulture); dis.daycreate = timediscipline; dis.ghichu = disrq.ghichu; dis.updateday = DateTime.Now; dis.active = true; dis.approved = true; dis.accept = true; data.success = true; m_adDisciplineResponsitory.insertDiscipline(dis); data.message = "insert success"; } catch (Exception e) { data.success = false; data.message = e.Message; data.error = e; } return(data); }
public DataRespond updateDiscipline(DisciplineRequest disrq) { DataRespond data = new DataRespond(); try { Discipline dis = m_DisciplineResponsitory.findDisciplineById(disrq.dsid); dis.fileid = disrq.fileid; dis.noidung = disrq.noidung; dis.donvi = disrq.donvi; DateTime timediscipline = DateTime.ParseExact(disrq.daycreate, "dd/MM/yyyy", CultureInfo.InvariantCulture); dis.daycreate = timediscipline; dis.ghichu = disrq.ghichu; data.success = true; m_DisciplineResponsitory.updateDisciplines(dis); data.message = "update success"; data.data = m_DisciplineResponsitory.findDisciplineById(dis.dsid); } catch (Exception e) { data.error = e; data.message = e.Message; data.success = false; } return(data); }