public IActionResult Add(HomeCatFormModel model) { var ownerId = this.userManager.GetUserId(User); var success = this.homeCats.Add( model.Name, model.Image, model.Age, model.Description, model.Gender, ownerId); if (!success) { return(this.BadRequest()); } //this.TempData.AddSuccessMessage($"The cat {model.Name} was added successfully!"); return(this.RedirectToAction(nameof(All))); }
public IActionResult Edit(int id, HomeCatFormModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } var catExists = this.homeCats.Exists(id); if (!catExists) { return(this.NotFound()); } this.homeCats.Edit(id, model.Name, model.Age, model.Description, model.Image, model.Gender); return(this.RedirectToAction(nameof(this.All))); }