public tblM_UserDetail CreateFromDbAndUpdateFromDTO(UserDetailDTO userDetailDTO, DateTime dateStamp) { tblM_UserDetail userDetail; if (userDetailDTO == null) { throw new ArgumentNullException("UserDetail model is null."); } userDetail = Db.tblM_UserDetail.Find(userDetailDTO.UserDetail_PK); if (userDetail == null) { throw new KairosException($"Record with key '{userDetailDTO.UserDetail_PK}' is not found."); } //userDetail.UpdateValueFrom(userDetailDTO, "UserDetail_PK", "Status_FK"); userDetail.UpdateValueFrom(userDetailDTO, "UserDetail_PK"); if (!string.IsNullOrEmpty(userDetailDTO.FilePhotoInBase64)) { userDetail.FilePhoto = new WebImageConverter().GetBytesFromBase64(userDetailDTO.FilePhotoInBase64); } userDetailDTO.CreatedBy = userDetail.CreatedBy; userDetailDTO.CreatedDate = userDetail.CreatedDate; userDetail.Project = userDetailDTO.Project; userDetail.UpdatedBy = userDetailDTO.UpdatedBy = User.Username; userDetail.UpdatedDate = userDetailDTO.UpdatedDate = dateStamp; return(userDetail); }
public tblM_UserDetail CreateFromDTO(UserDetailDTO userDetailDTO, DateTime dateStamp) { if (userDetailDTO == null) { throw new ArgumentNullException("UserDetail model is null."); } userDetailDTO.Status_FK = (int)RecordStatus.Active; userDetailDTO.CreatedBy = User.Username; userDetailDTO.CreatedDate = dateStamp; userDetailDTO.UpdatedBy = User.Username; userDetailDTO.UpdatedDate = dateStamp; tblM_UserDetail userDetail = userDetailDTO.ToObject <tblM_UserDetail>(); return(userDetail); }
public tblM_UserDetail CreateFromDTO(UserDetailDTO userDetailDTO, DateTime dateStamp) { if (userDetailDTO == null) { throw new ArgumentNullException("UserDetail model is null."); } userDetailDTO.Status_FK = (int)RecordStatus.Active; userDetailDTO.CreatedBy = User.Username; userDetailDTO.CreatedDate = dateStamp; userDetailDTO.UpdatedBy = User.Username; userDetailDTO.UpdatedDate = dateStamp; tblM_UserDetail userDetail = userDetailDTO.ToObject <tblM_UserDetail>(); if (!string.IsNullOrEmpty(userDetailDTO.FilePhotoInBase64)) { userDetail.FilePhoto = new WebImageConverter().GetBytesFromBase64(userDetailDTO.FilePhotoInBase64); } return(userDetail); }
public tblM_UserDetail CreateFromDbAndUpdateFromDTO(UserDetailDTO userDetailDTO, DateTime dateStamp) { tblM_UserDetail userDetail; if (userDetailDTO == null) { throw new ArgumentNullException("UserDetail model is null."); } userDetail = Db.tblM_UserDetail.Find(userDetailDTO.UserDetail_PK); if (userDetail == null) { throw new KairosException($"Record with key '{userDetailDTO.UserDetail_PK}' is not found."); } userDetail.UpdateValueFrom(userDetailDTO, "UserDetail_PK", "Status_FK"); userDetailDTO.CreatedBy = userDetail.CreatedBy; userDetailDTO.CreatedDate = userDetail.CreatedDate; userDetail.UpdatedBy = userDetailDTO.UpdatedBy = User.Username; userDetail.UpdatedDate = userDetailDTO.UpdatedDate = dateStamp; return(userDetail); }