public async Task <IActionResult> Edit(int id, Testimonial testimonial)
        {
            if (id != testimonial.TestimonialId)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                try
                {
                    bool result = await _repo.Update(testimonial);

                    if (result)
                    {
                        return(RedirectToAction("Index"));
                    }
                    return(View("Edit", new { id }));
                }
                catch
                {
                }
            }
            return(RedirectToAction("Error", "Home"));
        }
示例#2
0
 public ResponseModel Update(Testimonial testimonial)
 {
     return(_testimonialRepository.Update(testimonial));
 }