public IActionResult Delete(int id) { PropFloor abs = _PropFloorRepository.GetPropFloorById(id); if (abs == null) { return(NotFound()); } _PropFloorRepository.DeletePropFloor(abs); return(RedirectToAction("index")); }
public void UpdatePropFloor(PropFloor PropFloorToUpdate, PropFloor model) { PropFloorToUpdate.Status = model.Status; PropFloorToUpdate.PropertyId = model.PropertyId; PropFloorToUpdate.Name = model.Name; PropFloorToUpdate.Area = model.Area; PropFloorToUpdate.Photo = model.Photo; PropFloorToUpdate.ModifiedBy = model.ModifiedBy; PropFloorToUpdate.ModifiedAt = DateTime.Now; _context.SaveChanges(); }
public IActionResult Edit(int id) { ViewBag.Properties = _propertyRepository.GetAllProperties(); PropFloor abs = _PropFloorRepository.GetPropFloorById(id); if (abs == null) { return(NotFound()); } return(View(abs)); }
public IActionResult Create(PropFloor PropFloor) { if (ModelState.IsValid) { PropFloor.CreatedBy = _admin.Fullname; _PropFloorRepository.CreatePropFloor(PropFloor); return(RedirectToAction("index")); } ViewBag.Properties = _propertyRepository.GetAllProperties(); return(View(PropFloor)); }
public IActionResult Edit(PropFloor abs) { if (ModelState.IsValid) { abs.ModifiedBy = _admin.Fullname; PropFloor PropFloorToUpdate = _PropFloorRepository.GetPropFloorById(abs.Id); if (PropFloorToUpdate == null) { return(NotFound()); } _PropFloorRepository.UpdatePropFloor(PropFloorToUpdate, abs); return(RedirectToAction("index")); } ViewBag.Properties = _propertyRepository.GetAllProperties(); return(View(abs)); }
public void DeletePropFloor(PropFloor PropFloor) { _context.PropFloors.Remove(PropFloor); _context.SaveChanges(); }
public void CreatePropFloor(PropFloor model) { model.CreatedAt = DateTime.Now; _context.PropFloors.Add(model); _context.SaveChanges(); }