Пример #1
0
        public ActionResult Delete(int id, IDeleteService service)
        {
            var response = service.Delete<Blog>(id);
            if (response.IsValid)
                TempData["message"] = response.SuccessMessage;
            //else it throws a concurrecy error, which shows the default error page.

            return RedirectToAction("Index");
        }
Пример #2
0
        public ActionResult Delete(int id, IDeleteService service)
        {
            var response = service.Delete<Tag>(id);
            if (response.IsValid)
                TempData["message"] = response.SuccessMessage;
            else
                //else errors, so send back an error message
                TempData["errorMessage"] = new MvcHtmlString(response.ErrorsAsHtml());

            return RedirectToAction("Index");
        }
        public ActionResult DeleteSalesOrder(int salesOrderId, IDeleteService service)
        {
            var response = service.Delete<SalesOrderHeader>(salesOrderId);
            if (response.IsValid)
                return Json(new { SuccessMessage = response.SuccessMessage });

            //else errors, so copy the errors over to the ModelState
            response.CopyErrorsToModelState(ModelState);

            return Json(ModelState.ToDataSourceResult());
        }
        public ActionResult DeleteLineItem(CrudSalesOrderDetailDto salesOrder, IDeleteService service)
        {
            var response = service.DeleteWithRelationships<SalesOrderDetail>(DeleteLineItemHelper.UpdateSalesOrderHeader,
                salesOrder.SalesOrderID, salesOrder.SalesOrderDetailID);
            if (response.IsValid)
                return Json(new { SuccessMessage = response.SuccessMessage });

            //else errors, so copy the errors over to the ModelState
            response.CopyErrorsToModelState(ModelState);

            return Json(ModelState.ToDataSourceResult());
        }
Пример #5
0
 public BaseJsonApiController(
     IJsonApiContext jsonApiContext,
     IGetAllService <T, int> getAll   = null,
     IGetByIdService <T, int> getById = null,
     IGetRelationshipService <T, int> getRelationship   = null,
     IGetRelationshipsService <T, int> getRelationships = null,
     ICreateService <T, int> create = null,
     IUpdateService <T, int> update = null,
     IUpdateRelationshipService <T, int> updateRelationships = null,
     IDeleteService <T, int> delete = null
     ) : base(jsonApiContext, getAll, getById, getRelationship, getRelationships, create, update, updateRelationships, delete)
 {
 }
Пример #6
0
 public UserService(
     MainDbContext dbContext,
     IOptions <AppSettings> appSettings,
     ISmsService smsService,
     IImageService imageService,
     IDeleteService deleteService)
 {
     this.dbContext     = dbContext;
     this.appSettings   = appSettings.Value;
     this.smsService    = smsService;
     this.imageService  = imageService;
     this.deleteService = deleteService;
 }
Пример #7
0
 public JsonApiController(
     IJsonApiOptions jsonApiOptions,
     IGetAllService <T, TId> getAll   = null,
     IGetByIdService <T, TId> getById = null,
     IGetRelationshipService <T, TId> getRelationship   = null,
     IGetRelationshipsService <T, TId> getRelationships = null,
     ICreateService <T, TId> create = null,
     IUpdateService <T, TId> update = null,
     IUpdateRelationshipService <T, TId> updateRelationships = null,
     IDeleteService <T, TId> delete = null
     ) : base(jsonApiOptions, getAll, getById, getRelationship, getRelationships, create, update, updateRelationships, delete)
 {
 }
Пример #8
0
 public AccountController(IDepartmentsService departmentsService, IUsersService usersService, IActionLogsService actionLogsService,
                          IEmailService emailService, IUserProfileService userProfileService, IDeleteService deleteService, IAuthorizationService authorizationService,
                          ILimitsService limitsService, IPersonnelRolesService personnelRolesService)
 {
     _departmentsService    = departmentsService;
     _usersService          = usersService;
     _actionLogsService     = actionLogsService;
     _emailService          = emailService;
     _userProfileService    = userProfileService;
     _deleteService         = deleteService;
     _authorizationService  = authorizationService;
     _limitsService         = limitsService;
     _personnelRolesService = personnelRolesService;
 }
        public ActionResult CustomerDelete(int customerId, IDeleteService service)
        {
            var response = service.Delete <Customer>(customerId);

            if (response.IsValid)
            {
                return(Json(new { SuccessMessage = response.SuccessMessage }));
            }

            //else errors, so copy the errors over to the ModelState
            response.CopyErrorsToModelState(ModelState);

            return(Json(ModelState.ToDataSourceResult()));
        }
Пример #10
0
 public BaseJsonApiController(
     IJsonApiOptions jsonApiOptions,
     IResourceQueryService <T, TId> queryService = null,
     IResourceCmdService <T, TId> cmdService     = null)
 {
     _jsonApiOptions      = jsonApiOptions;
     _getAll              = queryService;
     _getById             = queryService;
     _getRelationship     = queryService;
     _getRelationships    = queryService;
     _create              = cmdService;
     _update              = cmdService;
     _updateRelationships = cmdService;
     _delete              = cmdService;
 }
Пример #11
0
 /// <inheritdoc />
 public JsonApiController(
     IJsonApiOptions options,
     ILoggerFactory loggerFactory,
     IGetAllService <TResource, TId> getAll                          = null,
     IGetByIdService <TResource, TId> getById                        = null,
     IGetSecondaryService <TResource, TId> getSecondary              = null,
     IGetRelationshipService <TResource, TId> getRelationship        = null,
     ICreateService <TResource, TId> create                          = null,
     IUpdateService <TResource, TId> update                          = null,
     IUpdateRelationshipService <TResource, TId> updateRelationships = null,
     IDeleteService <TResource, TId> delete                          = null)
     : base(options, loggerFactory, getAll, getById, getSecondary, getRelationship, create, update,
            updateRelationships, delete)
 {
 }
Пример #12
0
 public StoreOrchestrator(
     IDicomRequestContextAccessor contextAccessor,
     IFileStore fileStore,
     IMetadataStore metadataStore,
     IIndexDataStore indexDataStore,
     IDeleteService deleteService,
     IQueryTagService queryTagService)
 {
     _contextAccessor = EnsureArg.IsNotNull(contextAccessor, nameof(contextAccessor));
     _fileStore       = EnsureArg.IsNotNull(fileStore, nameof(fileStore));
     _metadataStore   = EnsureArg.IsNotNull(metadataStore, nameof(metadataStore));
     _indexDataStore  = EnsureArg.IsNotNull(indexDataStore, nameof(indexDataStore));
     _deleteService   = EnsureArg.IsNotNull(deleteService, nameof(deleteService));
     _queryTagService = EnsureArg.IsNotNull(queryTagService, nameof(queryTagService));
 }
Пример #13
0
 public ResourceController(
     IJsonApiOptions jsonApiOptions,
     ILoggerFactory loggerFactory,
     IGetAllService <Resource, int> getAll   = null,
     IGetByIdService <Resource, int> getById = null,
     IGetRelationshipService <Resource, int> getRelationship   = null,
     IGetRelationshipsService <Resource, int> getRelationships = null,
     ICreateService <Resource, int> create = null,
     IUpdateService <Resource, int> update = null,
     IUpdateRelationshipService <Resource, int> updateRelationships = null,
     IDeleteService <Resource, int> delete = null)
     : base(jsonApiOptions, loggerFactory, getAll, getById, getRelationship, getRelationships, create,
            update, updateRelationships, delete)
 {
 }
Пример #14
0
        public ActionResult DeleteLineItem(CrudSalesOrderDetailDto salesOrder, IDeleteService service)
        {
            var response = service.DeleteWithRelationships <SalesOrderDetail>(DeleteLineItemHelper.UpdateSalesOrderHeader,
                                                                              salesOrder.SalesOrderID, salesOrder.SalesOrderDetailID);

            if (response.IsValid)
            {
                return(Json(new { SuccessMessage = response.SuccessMessage }));
            }

            //else errors, so copy the errors over to the ModelState
            response.CopyErrorsToModelState(ModelState);

            return(Json(ModelState.ToDataSourceResult()));
        }
Пример #15
0
        public StoreOrchestrator(
            IFileStore fileStore,
            IMetadataStore metadataStore,
            IIndexDataStore indexDataStore,
            IDeleteService deleteService)
        {
            EnsureArg.IsNotNull(fileStore, nameof(fileStore));
            EnsureArg.IsNotNull(metadataStore, nameof(metadataStore));
            EnsureArg.IsNotNull(indexDataStore, nameof(indexDataStore));
            EnsureArg.IsNotNull(deleteService, nameof(deleteService));

            _fileStore      = fileStore;
            _metadataStore  = metadataStore;
            _indexDataStore = indexDataStore;
            _deleteService  = deleteService;
        }
 public FullBaseJsonApiController(
     IJsonApiContext jsonApiContext,
     IGetAllService <T, TId> getAll   = null,
     IGetByIdService <T, TId> getById = null,
     IGetRelationshipService <T, TId> getRelationship   = null,
     IGetRelationshipsService <T, TId> getRelationships = null,
     ICreateService <T, TId> create = null,
     IUpdateService <T, TId> update = null,
     IUpdateRelationshipService <T, TId> updateRelationships = null,
     IDeleteService <T, TId> delete = null
     ) : base(jsonApiContext, getAll, getById, create, update, delete)
 {
     _getRelationship     = getRelationship;
     _getRelationships    = getRelationships;
     _updateRelationships = updateRelationships;
 }
Пример #17
0
 public GroupsController(IDepartmentsService departmentsService, IUsersService usersService, IDepartmentGroupsService departmentGroupsService,
                         Model.Services.IAuthorizationService authorizationService, ILimitsService limitsService, IGeoLocationProvider geoLocationProvider, IDeleteService deleteService,
                         IEventAggregator eventAggregator, IUserProfileService userProfileService, IUnitsService unitsService, IShiftsService shiftsService)
 {
     _departmentsService      = departmentsService;
     _usersService            = usersService;
     _departmentGroupsService = departmentGroupsService;
     _authorizationService    = authorizationService;
     _limitsService           = limitsService;
     _geoLocationProvider     = geoLocationProvider;
     _deleteService           = deleteService;
     _eventAggregator         = eventAggregator;
     _userProfileService      = userProfileService;
     _unitsService            = unitsService;
     _shiftsService           = shiftsService;
 }
Пример #18
0
        public ActionResult Delete(int id, IDeleteService service)
        {
            var response = service.Delete <Post>(id);

            if (response.IsValid)
            {
                TempData["message"] = response.SuccessMessage;
            }
            else
            {
                //else errors, so send back an error message
                TempData["errorMessage"] = new MvcHtmlString(response.ErrorsAsHtml());
            }

            return(RedirectToAction("Index"));
        }
        public ActionResult DeleteAddress(int customerId, int addressId, IDeleteService service)
        {
            var response = service.DeleteWithRelationships <CustomerAddress>(DeleteHelpers.DeleteAssociatedAddress, customerId, addressId);

            if (response.IsValid)
            {
                TempData["message"] = response.SuccessMessage;
            }
            else
            {
                //else errors, so send back an error message
                TempData["errorMessage"] = new MvcHtmlString(response.ErrorsAsHtml());
            }

            return(RedirectToAction("Details", new { id = customerId }));
        }
 public ResourceController(
     IJsonApiOptions options,
     ILoggerFactory loggerFactory,
     IGetAllService <Resource, int> getAll                                 = null,
     IGetByIdService <Resource, int> getById                               = null,
     IGetSecondaryService <Resource, int> getSecondary                     = null,
     IGetRelationshipService <Resource, int> getRelationship               = null,
     ICreateService <Resource, int> create                                 = null,
     IAddToRelationshipService <Resource, int> addToRelationship           = null,
     IUpdateService <Resource, int> update                                 = null,
     ISetRelationshipService <Resource, int> setRelationship               = null,
     IDeleteService <Resource, int> delete                                 = null,
     IRemoveFromRelationshipService <Resource, int> removeFromRelationship = null)
     : base(options, loggerFactory, getAll, getById, getSecondary, getRelationship, create, addToRelationship,
            update, setRelationship, delete, removeFromRelationship)
 {
 }
Пример #21
0
        public async Task <IActionResult> DeleteConfirmed(int id,
                                                          [FromServices] IDeleteService deleteService)
        {
            Comment comment = await commentServices.GetComment(id);

            bool mayDelete = deleteService.MayDelete(User.Identity.Name, comment.PublishedBy, User.IsInRole("Admin"), User.IsInRole("PowerUser"));

            if (mayDelete == true)
            {
                await commentServices.DeleteComment(comment);
            }
            else
            {
                return(RedirectToAction("Details", "Post", new { id = comment.PostId, error = "You have not the rights to delete other persons comments!" }));
            }
            return(RedirectToAction("Details", "Post", new { id = comment.PostId, error = "" }));
        }
        public StoreOrchestrator(
            IFileStore fileStore,
            IMetadataStore metadataStore,
            IIndexDataStoreFactory indexDataStoreFactory,
            IDeleteService deleteService,
            IQueryTagService queryTagService)
        {
            EnsureArg.IsNotNull(fileStore, nameof(fileStore));
            EnsureArg.IsNotNull(metadataStore, nameof(metadataStore));
            EnsureArg.IsNotNull(indexDataStoreFactory, nameof(indexDataStoreFactory));
            EnsureArg.IsNotNull(deleteService, nameof(deleteService));
            EnsureArg.IsNotNull(queryTagService, nameof(queryTagService));

            _fileStore       = fileStore;
            _metadataStore   = metadataStore;
            _deleteService   = deleteService;
            _queryTagService = queryTagService;
            _indexDataStore  = indexDataStoreFactory.GetInstance();
        }
Пример #23
0
 /// <param name="jsonApiOptions"></param>
 /// <param name="getAll"></param>
 /// <param name="getById"></param>
 /// <param name="getRelationship"></param>
 /// <param name="getRelationships"></param>
 /// <param name="create"></param>
 /// <param name="update"></param>
 /// <param name="updateRelationships"></param>
 /// <param name="delete"></param>
 public BaseJsonApiController(
     IJsonApiOptions jsonApiOptions,
     IGetAllService <T, TId> getAll   = null,
     IGetByIdService <T, TId> getById = null,
     IGetRelationshipService <T, TId> getRelationship   = null,
     IGetRelationshipsService <T, TId> getRelationships = null,
     ICreateService <T, TId> create = null,
     IUpdateService <T, TId> update = null,
     IUpdateRelationshipService <T, TId> updateRelationships = null,
     IDeleteService <T, TId> delete = null)
 {
     _jsonApiOptions      = jsonApiOptions;
     _getAll              = getAll;
     _getById             = getById;
     _getRelationship     = getRelationship;
     _getRelationships    = getRelationships;
     _create              = create;
     _update              = update;
     _updateRelationships = updateRelationships;
     _delete              = delete;
 }
        /// <summary>
        /// 尝试删除下游单据,返回删除结果
        /// </summary>
        /// <param name="tableNumber">下游单据表格编码</param>
        /// <param name="entityIds">下游单据体内码</param>
        /// <returns></returns>
        private IOperationResult DeleteTargetBill(
            string tableNumber, HashSet <long> entityIds)
        {
            IBusinessFlowService bfService   = ServiceHelper.GetService <IBusinessFlowService>();
            TableDefine          tableDefine = bfService.LoadTableDefine(this.Context, tableNumber);

            // 读取下游单据的元数据
            IMetaDataService metaService = ServiceHelper.GetService <IMetaDataService>();
            FormMetadata     meta        = metaService.Load(
                this.Context, tableDefine.FormId) as FormMetadata;

            // 根据下游单据体的内码,读取单据内码
            HashSet <long> billIds = this.LoadTargetBillIds(meta.BusinessInfo, tableDefine.EntityKey, entityIds);

            object[] pkValues = (from p in billIds select(object) p).ToArray();
            // 调用删除服务,删除单据
            IDeleteService   deleteService = ServiceHelper.GetService <IDeleteService>();
            IOperationResult deleteResult  = deleteService.Delete(this.Context, meta.BusinessInfo,
                                                                  pkValues, this.Option);

            return(deleteResult);
        }
Пример #25
0
 protected BaseJsonApiController(
     IJsonApiOptions jsonApiOptions,
     ILoggerFactory loggerFactory,
     IGetAllService <T, TId> getAll                          = null,
     IGetByIdService <T, TId> getById                        = null,
     IGetSecondaryService <T, TId> getSecondary              = null,
     IGetRelationshipService <T, TId> getRelationship        = null,
     ICreateService <T, TId> create                          = null,
     IUpdateService <T, TId> update                          = null,
     IUpdateRelationshipService <T, TId> updateRelationships = null,
     IDeleteService <T, TId> delete                          = null)
 {
     _jsonApiOptions      = jsonApiOptions;
     _logger              = loggerFactory.CreateLogger <BaseJsonApiController <T, TId> >();
     _getAll              = getAll;
     _getById             = getById;
     _getSecondary        = getSecondary;
     _getRelationship     = getRelationship;
     _create              = create;
     _update              = update;
     _updateRelationships = updateRelationships;
     _delete              = delete;
 }
        /// <summary>
        /// Creates an instance from separate services for the various individual read and write methods.
        /// </summary>
        protected BaseJsonApiController(IJsonApiOptions options, ILoggerFactory loggerFactory, IGetAllService <TResource, TId> getAll = null,
                                        IGetByIdService <TResource, TId> getById = null, IGetSecondaryService <TResource, TId> getSecondary                   = null,
                                        IGetRelationshipService <TResource, TId> getRelationship               = null, ICreateService <TResource, TId> create = null,
                                        IAddToRelationshipService <TResource, TId> addToRelationship           = null, IUpdateService <TResource, TId> update = null,
                                        ISetRelationshipService <TResource, TId> setRelationship               = null, IDeleteService <TResource, TId> delete = null,
                                        IRemoveFromRelationshipService <TResource, TId> removeFromRelationship = null)
        {
            ArgumentGuard.NotNull(options, nameof(options));
            ArgumentGuard.NotNull(loggerFactory, nameof(loggerFactory));

            _options                = options;
            _traceWriter            = new TraceLogWriter <BaseJsonApiController <TResource, TId> >(loggerFactory);
            _getAll                 = getAll;
            _getById                = getById;
            _getSecondary           = getSecondary;
            _getRelationship        = getRelationship;
            _create                 = create;
            _addToRelationship      = addToRelationship;
            _update                 = update;
            _setRelationship        = setRelationship;
            _delete                 = delete;
            _removeFromRelationship = removeFromRelationship;
        }
Пример #27
0
        public BaseJsonApiController(
            IJsonApiOptions jsonApiOptions,
            IResourceService <T, TId> resourceService,
            ILoggerFactory loggerFactory)
        {
            if (loggerFactory != null)
            {
                _logger = loggerFactory.CreateLogger <BaseJsonApiController <T, TId> >();
            }
            else
            {
                _logger = new Logger <BaseJsonApiController <T, TId> >(new LoggerFactory());
            }

            _jsonApiOptions      = jsonApiOptions;
            _getAll              = resourceService;
            _getById             = resourceService;
            _getRelationship     = resourceService;
            _getRelationships    = resourceService;
            _create              = resourceService;
            _update              = resourceService;
            _updateRelationships = resourceService;
            _delete              = resourceService;
        }
        public ActionResult DeleteAddress(int customerId, int addressId, IDeleteService service)
        {
            var response = service.DeleteWithRelationships<CustomerAddress>( DeleteHelpers.DeleteAssociatedAddress, customerId, addressId);
            if (response.IsValid)
                TempData["message"] = response.SuccessMessage;
            else
                //else errors, so send back an error message
                TempData["errorMessage"] = new MvcHtmlString(response.ErrorsAsHtml());

            return RedirectToAction("Details", new { id = customerId });
        }
Пример #29
0
 public UserController(IPasswordService passwordService, ISessionService sessionService, INotificationService notificationService, IDeleteService deleteService, GetDatabaseContext getDatabaseContext, ILogger <UserController> logger, ILoggerFactory loggerFactory)
 {
     _passwordService     = passwordService;
     _sessionService      = sessionService;
     _notificationService = notificationService;
     _deleteService       = deleteService;
     _getDatabaseContext  = getDatabaseContext;
     _logger      = logger;
     _auditLogger = loggerFactory.CreateAuditLogger();
 }
 public OrganizeAppointmentController(INotificationService notificationService, IDeleteService deleteService, GetDatabaseContext getDatabaseContext, ILogger <OrganizeAppointmentController> logger, ILoggerFactory loggerFactory)
 {
     _notificationService = notificationService;
     _deleteService       = deleteService;
     _getDatabaseContext  = getDatabaseContext;
     _logger      = logger;
     _auditLogger = loggerFactory.CreateAuditLogger();
 }
Пример #31
0
 public DeleteModel()
 {
     _getService          = Startup.AutofacContainer.Resolve <IGetService>();
     _deleteService       = Startup.AutofacContainer.Resolve <IDeleteService>();
     _registrationContext = Startup.AutofacContainer.Resolve <RegistrationContext>();
 }
Пример #32
0
 public DeleteSummaryController(IDeleteService deleteService)
 {
     _deleteService = deleteService;
 }
Пример #33
0
        public DeleteHandler(IDeleteService deleteService)
        {
            EnsureArg.IsNotNull(deleteService, nameof(deleteService));

            _deleteService = deleteService;
        }
Пример #34
0
 public DeleteModel(IGetService getService, IDeleteService deleteService, RegistrationContext registrationContext)
 {
     _getService          = getService;
     _deleteService       = deleteService;
     _registrationContext = registrationContext;
 }
Пример #35
0
 protected with_the_delete_service()
 {
     _deleteService = Resolve <IDeleteService>();
 }