private DrugUse EntityToModel(CR_DRUGUSE entity) { if (entity != null) { var model = new DrugUse() { ID = entity.ID, DISEASEID = entity.DISEASEID, USERID = entity.USERID, DRUGTYPE = entity.DRUGTYPE, DRUGNAME = entity.DRUGNAME, DRUGID = entity.DRUGID, TREATMENTDISEASES = entity.TREATMENTDISEASES, STARTTIME = entity.STARTTIME, ENDTIME = entity.ENDTIME, TIMESADAY = entity.TIMESADAY, DOSE = entity.DOSE, UNITS = entity.UNITS, USEDAY = entity.USEDAY, ISNEWDRUG = entity.ISNEWDRUG, CREATEUSERID = entity.CREATEUSERID, CREATEDATETIME = entity.CREATEDATETIME, EDITUSERID = entity.EDITUSERID, EDITDATETIME = entity.EDITDATETIME, ISDELETED = entity.ISDELETED, OWNERID = entity.OWNERID }; return(model); } return(null); }
private CR_DRUGUSE ModelToEntity(DrugUse model) { if (model != null) { var entity = new CR_DRUGUSE() { ID = context.Database.SqlQuery <int>("select CR_DRUGUSE_ID.nextval from dual").FirstOrDefault(), DISEASEID = model.DISEASEID, USERID = model.USERID, DRUGTYPE = model.DRUGTYPE, DRUGNAME = model.DRUGNAME, DRUGID = model.DRUGID, TREATMENTDISEASES = model.TREATMENTDISEASES, STARTTIME = model.STARTTIME, ENDTIME = model.ENDTIME, TIMESADAY = model.TIMESADAY, DOSE = model.DOSE, UNITS = model.UNITS, USEDAY = model.USEDAY, ISNEWDRUG = model.ISNEWDRUG, CREATEUSERID = model.CREATEUSERID, CREATEDATETIME = model.CREATEDATETIME, EDITUSERID = model.EDITUSERID, EDITDATETIME = model.EDITDATETIME, ISDELETED = model.ISDELETED, OWNERID = model.OWNERID }; return(entity); } return(null); }