public void DeleteRawRole(Guid id) { RawUserType roleDb = dbContext.RawUserTypes.FirstOrDefault(x => x.IdUserTypes == id); if (roleDb != null) { dbContext.RawUserTypes.DeleteOnSubmit(roleDb); dbContext.SubmitChanges(); } }
public void UpdateRawRole(RawUserTypesModel roles) { RawUserType roleDb = dbContext.RawUserTypes.FirstOrDefault(x => x.IdUserTypes == roles.IdUserTypes); if (roleDb != null) { roleDb.IdUserTypes = roles.IdUserTypes; roleDb.Name = roles.Name; dbContext.SubmitChanges(); } }
private RawUserTypesModel MapDbObjectToModel(RawUserType dbRole) { RawUserTypesModel role = new RawUserTypesModel(); if (dbRole != null) { role.IdUserTypes = dbRole.IdUserTypes; role.Name = dbRole.Name; return(role); } return(null); }
private RawUserType MapModelToDbObject(RawUserTypesModel role) { RawUserType roleDb = new RawUserType(); if (role != null) { roleDb.IdUserTypes = role.IdUserTypes; roleDb.Name = role.Name; return(roleDb); } return(null); }
private void AddDbObjectTo(List <RawUserTypesModel> rolesList, RawUserType dbRole) { rolesList.Add(MapDbObjectToModel(dbRole)); }