public async Task <IActionResult> Delete(int id) { var deleteAuthor = await _author.Delete(id); if (deleteAuthor) { return(RedirectToAction("Index")); } return(View()); }
//[HttpPost] public async Task <IActionResult> Delete(int id) { var deleteAuthor = await _author.Delete(id); if (deleteAuthor) { Alert("Author deleted successfully.", NotificationType.success); return(RedirectToAction("Index")); } Alert("Author not deleted!", NotificationType.error); return(View()); }
public async Task <IActionResult> Delete(int id) { var deleteAuthor = await _author.Delete(id); if (deleteAuthor) { return(Ok("Author Deleted")); } else { return(BadRequest(new { message = "Unable to delete Author details" })); } }
/// <summary> /// Delete the Blogger Details with his/her all blogs /// </summary> /// <returns>Index page</returns> public ActionResult Delete() { string email = FormsAuthentication.Decrypt(Request.Cookies[FormsAuthentication.FormsCookieName].Value).Name; var result = _author.Delete(email); if (result) { return(RedirectToAction("UserLogout", "Register")); } else { return(View("AutherProfile", "Blog")); } }
private void buttonDel_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 1) { if (MessageBox.Show("Удалить запись", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { int id = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[0].Value); try { author.Delete(new AuthorBindingModel { Id = id }); } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } LoadData(); } } }
public static bool Delete(string authorId) { return(DataValidator.IsValidId(authorId) && dal.Delete(authorId)); }
public async Task Delete(int id) { await _service.Delete(id); }