Exemplo n.º 1
0
        // POST api/values
        public void Post(Models.GasListModel value)
        {
            var db = new MyDBModels.DB();

            MyDBModels.GasList gasList = new MyDBModels.GasList();
            gasList.BusId      = value.BusId;
            gasList.CostGas    = value.CostGas;
            gasList.CountLitre = value.CountLitre;
            gasList.TimeGet    = value.TimeGet;
            db.gasList.Add(gasList);
            db.SaveChanges();
        }
Exemplo n.º 2
0
        public int Post(Models.GasListModel newGas, int number)
        {
            if (newGas != null && number > 0)
            {
                logic.logicMethodForPostData(newGas, number);

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Headers.CacheControl = new CacheControlHeaderValue()
                {
                    MaxAge = TimeSpan.FromMinutes(20)
                };
                return((int)response.StatusCode);
            }

            return((int)Request.CreateResponse(HttpStatusCode.BadRequest).StatusCode);
        }
Exemplo n.º 3
0
        public void postGas(Models.GasListModel value, int number)
        {
            var db       = new MyDBModels.DB();
            int idDriver = db.driver.Where(d => d.DriverNumber == number).FirstOrDefault().DriverId;

            MyDBModels.WorkList work = db.workList.Where(d => d.DriverId == idDriver && d.DateAction == value.TimeGet).FirstOrDefault();


            MyDBModels.GasList gasList = new MyDBModels.GasList();
            gasList.BusId      = work.BusId;
            gasList.CostGas    = value.CostGas;
            gasList.CountLitre = value.CountLitre;
            gasList.TimeGet    = value.TimeGet;
            gasList.TypeGas    = value.TypeGas;
            db.gasList.Add(gasList);
            db.SaveChanges();
        }
Exemplo n.º 4
0
 public void logicMethodForPostData(Models.GasListModel data, int number)
 {
     dataAccess.postGas(data, number);
 }