public bool Add(UnionManager.Models.DomainModels.Role entity, bool autoSave = true) { try { db.Roles.Add(entity); if (autoSave) { bool result = Convert.ToBoolean(db.SaveChanges()); return(result); } else { return(false); } } catch { return(false); } }
public bool Add(UnionManager.Models.DomainModels.User entity, out string message, bool autoSave = true) { try { db.Users.Add(entity); if (autoSave) { bool result = Convert.ToBoolean(db.SaveChanges()); message = ""; return(result); } else { message = ""; return(false); } } catch (Exception ex) { message = ex.GetBaseException().Message; return(false); } }