コード例 #1
0
        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());
            }
        }
コード例 #2
0
        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());
        }
コード例 #4
0
        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"));
 }
コード例 #9
0
 public IHttpActionResult Delete(string id)
 {
     _catalogService.Delete(new string[] { id });
     return(StatusCode(HttpStatusCode.NoContent));
 }