public async Task <Housing> UpdateHousingAsync(Housing housing) { try { var housingExist = dbContext.Housings.FirstOrDefault(h => h.Housing_Id == housing.Housing_Id); if (housingExist != null) { dbContext.Update(housing); await dbContext.SaveChangesAsync(); } } catch (Exception) { throw; } return(housing); }
public async Task <Address> UpdateAddressAsync(Address address) { try { var addressExist = dbContext.Address.FirstOrDefault(a => a.Adres_Id == address.Adres_Id); if (addressExist != null) { dbContext.Update(address); await dbContext.SaveChangesAsync(); } } catch (Exception) { throw; } return(address); }
public async Task <Estate> UpdateEstateAsync(Estate estate) { try { var estateExist = dbContext.Estates.FirstOrDefault(e => e.Nick_Name == estate.Nick_Name); if (estateExist != null) { dbContext.Update(estate); await dbContext.SaveChangesAsync(); } } catch (Exception) { throw; } return(estate); }
public async Task <Workplace> UpdateWorkplaceAsync(Workplace workplace) { try { var workplaceExist = dbContext.Workplaces.FirstOrDefault(w => w.W_Id == workplace.W_Id); if (workplaceExist != null) { dbContext.Update(workplace); await dbContext.SaveChangesAsync(); } } catch (Exception) { throw; } return(workplace); }
public async Task <User> UpdateUserAsync(User user) { try { var userExist = dbContext.Users.FirstOrDefault(a => a.User_name == user.User_name); if (userExist != null) { dbContext.Update(user); await dbContext.SaveChangesAsync(); } } catch (Exception) { throw; } return(user); }
public async Task<House> UpdateHouseAsync(House house) { try { var houseExist = dbContext.Houses.FirstOrDefault(h => h.House_Id == house.House_Id); if(houseExist!=null) { dbContext.Update(house); await dbContext.SaveChangesAsync(); } } catch(Exception) { throw; } return house; }
public async Task <Host> UpdateHostAsync(Host host) { try { var hostExist = dbContext.Hosts.FirstOrDefault(h => h.Host_Id == host.Host_Id); if (hostExist != null) { dbContext.Update(host); await dbContext.SaveChangesAsync(); } } catch (Exception) { throw; } return(host); }