Exemple #1
0
 protected override ValueTask DependencyInjection()
 {
     this.GrainFactory = this.ServiceProvider.GetService <IGrainFactory>();
     this.crudHandle   = this.ServiceProvider.GetService <ICrudHandler <TPrimaryKey, TSnapshot> >();
     this.mapper       = this.ServiceProvider.GetService <IMapper>();
     return(base.DependencyInjection());
 }
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     base.OnActionExecuting(context);
     _handler          = new MenuItemHandler(_context, _user);
     _categoryHandler  = new CategoryHandler(_context, _user);
     _priceTypeHandler = new PriceTypeHandler(_context, _user);
     _imageHandler     = new ImageHandler(_context, _user);
 }
Exemple #3
0
        public IDictionary <string, string> HandleRequest(Request request, ICrudHandler handler)
        {
            IDictionary <string, string> response = new Dictionary <string, string>();

            if (request.Type == RequestType.Create)
            {
                handler.Create(request.EntityName, request.Arguments);
                response["result"] = "success";
            }

            if (request.Type == RequestType.Get)
            {
                IEnumerable foundObjects = handler.Read(request.EntityName, request.Arguments);
                var         objectArray  = "[";
                var         isFirst      = true;
                foreach (var nextObject in foundObjects)
                {
                    if (isFirst)
                    {
                        objectArray += nextObject;
                        isFirst      = false;
                    }
                    else
                    {
                        objectArray += "," + nextObject;
                    }
                }

                response["result"]   = "success";
                response["selected"] = objectArray + "]";
            }

            if (request.Type == RequestType.Update)
            {
                handler.Update(request.EntityName, request.Arguments);
                response["result"] = "success";
            }

            if (request.Type == RequestType.Delete)
            {
                handler.Delete(request.EntityName, request.Arguments);
            }

            if (request.Type == RequestType.Default)
            {
                response["result"]  = "failure";
                response["message"] = "Unknown request type";
            }

            return(response);
        }
Exemple #4
0
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     base.OnActionExecuting(context);
     _handler = new PriceHandler(_context, _user);
 }
Exemple #5
0
 public MenuController(FoodTruckContext context) : base(context)
 {
     _handler = new MenuItemHandler(_context, "system");
 }
 public SettingsController(FoodTruckContext context, AzureSettings azureSettings) : base(context)
 {
     _azureSettings   = azureSettings;
     _handler         = new SettingHandler(_context);
     _squareLocations = new SquareLocationHandler(context, "system").GetAll();
 }
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     base.OnActionExecuting(context);
     _handler         = new FoodTruck.Data.Distribution.Handlers.Events.EventHandler(_context, _user);
     _locationHandler = new LocationHandler(_context, _user);
 }
Exemple #8
0
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     base.OnActionExecuting(context);
     _imageHandler    = new ImageHandler(_context, _user);
     _locationHandler = new LocationHandler(_context, _user);
 }
 public override void OnActionExecuting(ActionExecutingContext context)
 {
     base.OnActionExecuting(context);
     _handler = new DeliveryDestinationHandler(_context, _user);
 }
 public SpecialController(FoodTruckContext context) : base(context)
 {
     _handler = new SpecialHandler(_context, "system");
 }