Exemplo n.º 1
0
        public async Task <IActionResult> Delete(int id)
        {
            var deleteAuthor = await _author.Delete(id);

            if (deleteAuthor)
            {
                return(RedirectToAction("Index"));
            }
            return(View());
        }
Exemplo n.º 2
0
        //[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());
        }
Exemplo n.º 3
0
        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" }));
            }
        }
Exemplo n.º 4
0
        /// <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"));
            }
        }
Exemplo n.º 5
0
 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();
         }
     }
 }
Exemplo n.º 6
0
 public static bool Delete(string authorId)
 {
     return(DataValidator.IsValidId(authorId) && dal.Delete(authorId));
 }
Exemplo n.º 7
0
 public async Task Delete(int id)
 {
     await _service.Delete(id);
 }