Пример #1
0
        public ActionResult Create(PumpReadingViewModel PumpReadingViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var _ValidationErrors = new List <ValidationError>();

                    var PumpReading = new PumpReading
                    {
                        PumpReadingId   = Guid.Parse(PumpReadingViewModel.PumpReadingId),
                        PumpId          = Guid.Parse(PumpReadingViewModel.PumpId),
                        Pump            = null,
                        ReadingDate     = PumpReadingViewModel.ReadingDate,
                        SalesRate       = PumpReadingViewModel.SalesRate,
                        StartOfBusiness = PumpReadingViewModel.StartOfBusiness,
                        CloseOfBusiness = PumpReadingViewModel.CloseOfBusiness,
                        TotalVolumeSold = PumpReadingViewModel.TotalVolumeSold,
                        BusinessDayId   = Guid.Parse(""),
                        BusinessDay     = null
                    };


                    if ((m_Manager as PumpReadingManager).Save(PumpReading, _ValidationErrors))
                    {
                        return(this.RedirectToAction("Index"));
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    ViewBag.Pumps = (m_PumpManager as PumpManager).GetAll();
                    return(View(PumpReadingViewModel));
                }
            }
            catch (Exception Ew)
            {
                m_Logger.TraceException(Ew.Message, Ew);
                return(null);
            }
        }
Пример #2
0
        public ActionResult Edit(PumpReading PumpReading)
        {
            try
            {
                var _ValidationErrors = new List <ValidationError>();

                if ((m_Manager as PumpReadingManager).Update(PumpReading, _ValidationErrors))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(null);
                }
            }catch (Exception Ew)
            {
                m_Logger.TraceException(Ew.Message, Ew);
                return(null);
            }
        }