public bool EditUserSchool(UsersSchools model) { try { var dbModel = _context.UsersSchools .Select(x => x) .Where(x => x.UserId == model.UserId) .FirstOrDefault(); dbModel.Name = model.Name; dbModel.City = model.City; dbModel.Class = model.Class; dbModel.HouseNumber = model.HouseNumber; dbModel.Phone = model.Phone; dbModel.Street = model.Street; dbModel.PostalCode = model.PostalCode; _context.SaveChanges(); return true; } catch { return false; } }
public bool ChangeUserSchool(string userId, string name, string sClass, string city, string houseNumber, string postalCode, string street, string phone) { UsersSchools model = new UsersSchools { UserId = userId, Name = name, Class = sClass, City = city, HouseNumber = houseNumber, PostalCode = postalCode, Street = street, Phone = phone }; bool result = _userRepository.EditUserSchool(model); return result; }