public string DeleteAdvert(string Id) { try { MongoDbContext.DeleteAdvert(Id); return("Обїявление удалено"); } catch (Exception e) { return("Ошибка удаления объявления"); } }
public ActionResult Delete(string Id) { try { MongoDbContext.DeleteAdvert(Id); return(RedirectToAction("Index", new { IsPositive = true, Message = "Объявление удалено" })); } catch (Exception e) { return(RedirectToAction("Index", new { IsPositive = false, Message = "Во время удаления возникли ошибки" })); } }