public bool UpdateAddress(long companyId, CompanyAddressPoco address) { var isupdated = _repository.UpdateAddress(companyId, address); if (isupdated) { return true; } else { return false; } }
public bool UpdateAddress(long id, CompanyAddressPoco address) { try { CompanyPoco c = _db.Companies.Where(comp => comp.Id == id).FirstOrDefault(); CompanyAddressPoco a = c.Addresses.Single(ad => ad.AddressId == address.AddressId); a.Street = address.Street; a.Province = address.Province; a.City = address.City; a.Postal_Code = address.Postal_Code; _db.SaveChanges(); return true; } catch (Exception) { return false; } }
public void CreateAddress(long id, CompanyAddressPoco address) { _repository.CreateAddress(id, address); }
public void CreateAddress(long id, CompanyAddressPoco address) { CompanyPoco c = _db.Companies.Single(comp => comp.Id == id); c.Addresses.Add(address); _db.SaveChanges(); }