public static DTO_PRO_HoSoKhac post_PRO_HoSoKhac(AppEntities db, DTO_PRO_HoSoKhac item, string Username) { tbl_PRO_HoSoKhac dbitem = new tbl_PRO_HoSoKhac(); if (item != null) { dbitem.IDDeTai = item.IDDeTai; dbitem.IDFile = item.IDFile; dbitem.IsDisabled = item.IsDisabled; dbitem.IsDeleted = item.IsDeleted; dbitem.CreatedBy = Username; dbitem.CreatedDate = DateTime.Now; dbitem.ModifiedBy = Username; dbitem.ModifiedDate = DateTime.Now; try { db.tbl_PRO_HoSoKhac.Add(dbitem); db.SaveChanges(); BS_CUS_Version.update_CUS_Version(db, null, "DTO_PRO_HoSoKhac", DateTime.Now, Username); item.ID = dbitem.ID; item.CreatedBy = dbitem.CreatedBy; item.CreatedDate = dbitem.CreatedDate; item.ModifiedBy = dbitem.ModifiedBy; item.ModifiedDate = dbitem.ModifiedDate; } catch (DbEntityValidationException e) { errorLog.logMessage("post_PRO_HoSoKhac", e); item = null; } } return(item); }
public static DTO_PRO_HoSoKhac toDTO(tbl_PRO_HoSoKhac dbResult) { if (dbResult != null) { return(new DTO_PRO_HoSoKhac() { ID = dbResult.ID, IDDeTai = dbResult.IDDeTai, IDFile = dbResult.IDFile, IsDisabled = dbResult.IsDisabled, IsDeleted = dbResult.IsDeleted, CreatedDate = dbResult.CreatedDate, CreatedBy = dbResult.CreatedBy, ModifiedDate = dbResult.ModifiedDate, ModifiedBy = dbResult.ModifiedBy, }); } else { return(null); } }