public async Task <ActionResult> Delete(int id)
        {
            var result = await _menu.DeActiveAsync(id);

            return
                (Json(
                     new
            {
                redirectTo = Url.Action("Index", "Menu", new { Area = "Admin" }),
                message = result == 0 ? "Record deleted Failed!!!" : "Record deleted successfully!!!",
                position = "mainContent"
            }));
        }
Exemple #2
0
        public async Task <IHttpActionResult> Delete([FromBody] int id)
        {
            try
            {
                var deactive = await _menu.DeActiveAsync(id);

                var result = new
                {
                    Error   = deactive != 1,
                    Message = deactive != 1 ? "Menu Deactivation failed." : "",
                    Data    = deactive
                };
                return(Ok(result));
            }
            catch (Exception ex)
            {
                ex.WriteLog();
                return(BadRequest("Menu Deactivation failed."));
            }
        }