public IActionResult CreateUpdate() { var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); var petBusiness = _repo.PetBusiness.GetPetBusinessById(userId); FeedUpdate update = new FeedUpdate(); update.PetBusinessId = petBusiness.Id; update.BusinessName = petBusiness.Name; return(View(update)); }
public IActionResult CreateUpdate(FeedUpdate update) { FeedUpdate newUpdate = new FeedUpdate(); DateTime dt = DateTime.Now; string timeStamp = dt.ToShortDateString(); newUpdate.Description = update.Description; newUpdate.PubDate = timeStamp; newUpdate.PetBusinessId = update.PetBusinessId; newUpdate.BusinessName = update.BusinessName; _repo.FeedUpdate.Create(newUpdate); _repo.Save(); return(RedirectToAction(nameof(Index))); }