Esempio n. 1
0
        public Responce DeleteExtraction(Guid extractionId)
        {
            try
            {
                Добыча extraction = db.Добыча.Find(extractionId);

                db.Добыча.Remove(extraction);
                db.SaveChanges();

                return(Responce.CreateOkRespond());
            }
            catch (Exception e)
            {
                return(Responce.CreateErrorRespond(e.Message));
            }
        }
Esempio n. 2
0
        public Responce UpdateExtraction(Guid extractionId, string date, double value)
        {
            try
            {
                Добыча extraction = db.Добыча.Find(extractionId);
                extraction.Дата     = date.GetDate();
                extraction.Значение = value;

                db.Entry(extraction).State = EntityState.Modified;
                db.SaveChangesAsync();

                return(Responce.CreateOkRespond());
            }
            catch (Exception e)
            {
                return(Responce.CreateErrorRespond(e.Message));
            }
        }
Esempio n. 3
0
        public Responce CreateExtraction(Guid wellId, string date, double value)
        {
            try
            {
                Добыча extraction = new Добыча
                {
                    Дата        = date.GetDate(),
                    Значение    = value,
                    ID_Скважины = wellId
                };

                db.Добыча.Add(extraction);

                db.SaveChangesAsync();
                return(Responce.CreateOkRespond());
            }
            catch (Exception e)
            {
                return(Responce.CreateErrorRespond(e.Message));
            }
        }