public void EditLocation(LocationDTO edited) { var location = _locationRepo.Get(edited.Id).FirstOrDefault(); location.Street1 = edited.Street1; location.Street2 = edited.Street2; location.City = edited.City; location.State = edited.State; location.Country = edited.Country; _locationRepo.SaveChanges(); }
public IHttpActionResult Post(LocationDTO location) { _locationServ.EditLocation(location); if (ModelState.IsValid) { return Ok(); } else { return BadRequest(); } }
public LocationDTO GetLocation(int id) { var project = _projectRepo.Get(id); var location = (from p in project select p.Client.Location).FirstOrDefault(); var dto = new LocationDTO() { Id = location.Id, Street1 = location.Street1, Street2 = location.Street2, City = location.City, State = location.State, Country = location.Country }; return dto; }