public IActionResult About()//test function { var addr = new Address { City = "London", Country = "UK", Street = "ABC", Number = 818 }; var owner = new Owner { FullName = "Sayed Ali", Job = "Accountant", Avatar = "sayed.jpg", Address = addr, }; var item = new PortofolioItem { Name = "Calculations", Description = "Full report of company", ImageUrl = "portofolio5.jpg", Owner = owner }; _uow.AddressRepository.Insert(addr); _uow.OwnerRepository.Insert(owner); _uow.PortofolioItemRepository.Insert(item); _uow.Save(); return(View()); }
public ActionResult DeletePortofolioIteme(PortofolioItemViewModel model) { try { var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); var userId2 = uow.GetPortofolioItem(model.ItemId).Owner.UserId; if (userId.ToString() != userId2.ToString()) { return(RedirectToAction(nameof(ShowPortofolioItems))); } uow.PortofolioItemRepository.Delete(model.ItemId); uow.Save(); return(RedirectToAction(nameof(ShowPortofolioItems))); } catch { return(View(model)); } }