Пример #1
0
 /// <summary>
 /// Provides possibility to inject existing DbContext in order to maintain the same UnitOfWork
 /// If DbContext is not injected, it creates a new one
 /// </summary>
 /// <param name="db">DbContext</param>
 public BaseRepository(BriskContext db = null)
 {
     if (db == null)
     {
         db = new BriskContext();
     }
     DB = db;
 }
        public async Task <IActionResult> Get()
        {
            BriskContext context = new BriskContext
            {
                Data = new { }
            };

            // TODO: Check for timeout
            object result = await this.invoker.Execute(this.function, context);

            return(this.GetSuitableActionResult(result));
        }
        public async Task <IActionResult> Post()
        {
            using (StreamReader streamReader = new StreamReader(this.Request.Body, Encoding.UTF8))
                using (JsonReader reader = new JsonTextReader(streamReader))
                {
                    JsonSerializer serializer = new JsonSerializer();

                    BriskContext context = new BriskContext
                    {
                        Data = serializer.Deserialize(reader),
                    };

                    // TODO: Check for timeout
                    object result = await this.invoker.Execute(this.function, context);

                    return(this.GetSuitableActionResult(result));
                }
        }