public IActionResult CreateCleaningActivity(ApartmentCleaningDto cleaningDto) { ApartmentCleaningActivity cleaningActivity = new ApartmentCleaningActivity(); Apartment apartment = apartmentService.GetApartment(cleaningDto.ApartmentId); apartment.Status = Common.Enums.ApartmentStatus.Cleaned; unitOfWork.ApartmentRepository.Update(apartment); cleaningActivity.Apartment = apartment; cleaningActivity.HasIssuesToReport = cleaningDto.HasIssuesToReport; cleaningActivity.Notes = cleaningDto.Notes; unitOfWork.ApartmentCleaningRepository.Add(cleaningActivity); unitOfWork.SaveChanges(); List <Location> locations = unitOfWork.LocationRepository.GetLocations(); return(RedirectToAction("Index")); }
public void Update(ApartmentCleaningActivity apartmentCleaningActivity) { _context.ApartmentCleaningActivities.Update(apartmentCleaningActivity); _context.SaveChanges(); }
public ApartmentCleaningActivity Add(ApartmentCleaningActivity apartmentCleaningActivity) { _context.ApartmentCleaningActivities.Add(apartmentCleaningActivity); _context.SaveChanges(); return(apartmentCleaningActivity); }