public bool UpdateUser(int userId, AssetManager.Models.User user) { var userModel = user.MapTo <AssetManager.Data.Model.User>(); userModel.SetAuditFieldsOnUpdate(this.Context); this.DB.Update(userModel, new string[] { "DisplayName", "IsAdmin", "IsSFREditor", "IsReportViewer", "GroupedStations", "PhoneNumber", "Designation", "ModifiedBy", "DateModified" }); return(true); }
public int AddUser(AssetManager.Models.User user) { var doesEmailExist = this.DB.SingleOrDefault <AssetManager.Data.Model.User>("WHERE UserName = @0", user.UserName); if (doesEmailExist == null) { try { user.UserName = user.Email; var userModel = user.MapTo <AssetManager.Data.Model.User>(); userModel.SetAuditFieldsOnCreate(this.Context); user.Id = Convert.ToInt32(this.DB.Insert(userModel)); return(user.Id); } catch { return(0); } } return(0); }