public async Task <ActionResult> Delete(Guid id, CatalogDetailsViewModel request)
        {
            if (!ModelState.IsValid)
            {
                Alert("Bad Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View());
            }
            if (id == null)
            {
                Alert($"Invalid Request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View());
            }
            try
            {
                var result = await _catalogService.Delete(id);

                if (!result.Success)
                {
                    Alert($"Error! {result.Message}", NotificationType.info, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                    return(View());
                }
                Alert($"Catalog Deleted Successfully", NotificationType.success, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                Alert($"Error Occurred While processing the request", NotificationType.error, Int32.Parse(_appConfig.Value.NotificationDisplayTime));
                return(View());
            }
        }
        public IHttpActionResult Delete(string id)
        {
            var catalog = _catalogService.GetById(id);

            CheckCurrentUserHasPermissionForObjects(CatalogPredefinedPermissions.Delete, catalog);

            _catalogService.Delete(new[] { id });
            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#3
0
        public ActionResult Delete(string id)
        {
            var catalog = _catalogService.GetByIds(new[] { id });

            //TODO:
            //CheckCurrentUserHasPermissionForObjects(CatalogPredefinedPermissions.Delete, catalog);

            _catalogService.Delete(new[] { id });
            return(Ok());
        }
        public IActionResult Delete(int id)
        {
            var item = _catalogService.GetById(id);

            if (item != null)
            {
                _catalogService.Delete(item);
            }

            return(RedirectToAction(nameof(Index)));
        }
示例#5
0
        public IActionResult DeleteCatalog(int catalogId)
        {
            var catalog = catalogId > 0 ? _catalogService.Get(catalogId) : null;

            if (catalog == null)
            {
                return(NotFound());
            }

            _catalogService.Delete(catalog);
            return(R.Success.Result);
        }
示例#6
0
 void ICatalogService.Delete(string[] catalogIds)
 {
     _catalogService.Delete(catalogIds);
     ClearCache();
 }
示例#7
0
 public IHttpActionResult Delete(int id)
 {
     _catalogService.Delete(id);
     return(Ok());
 }
示例#8
0
 public ActionResult DeleteConfirmed(int id)
 {
     _service.Delete(id);
     return(RedirectToAction("Index"));
 }
 public IHttpActionResult Delete(string id)
 {
     _catalogService.Delete(new string[] { id });
     return(StatusCode(HttpStatusCode.NoContent));
 }