예제 #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"));
 }
 public IHttpActionResult Delete(string id)
 {
     _catalogService.Delete(new string[] { id });
     return(StatusCode(HttpStatusCode.NoContent));
 }