public IActionResult MallDetails(Guid?id) { if (id == null) { return(RedirectToAction(IndexAction, DefaultController)); } var mall = _mallRepository.GetOne(id.Value); if (mall == null) { return(View("MallNotFound", id.Value)); } return(View(mall)); }
public IActionResult AddStoreToMall(IEnumerable <Guid> storesToAdd, Guid mallId) { var mall = _mallRepository.GetOne(mallId); if (mall == null) { return(RedirectToAction(IndexAction, DefaultController)); } foreach (var storeId in storesToAdd) { var store = _storeRepository.GetOne(storeId); if (store == null) { return(View("StoreNotFound", storeId)); } if (store.MallId == null) { var updatedStore = new Store(store.Id, store.Name, mall.Location, store.Profit, mall.Id); _storeRepository.UpdateOne(updatedStore); } } return(RedirectToAction(IndexAction, "Malls")); }