Пример #1
0
        private void MapTierLevels(TierLevel response)
        {
            var tempLevels = (from t in response.Levels
                              select new LevelModel
            {
                LevelId = t.LevelId,
                LevelName = t.LevelName
            }).ToList();

            var tempTier = (from t in response.Tiers
                            select new TierModel
            {
                TierId = t.TierId,
                TierName = t.TierName
            }).ToList();

            var tempPumpTierLevel = (from p in response.PumpTierLevels
                                     select new PumpTierLevelModel
            {
                LevelId = p.LevelId,
                TierName = p.TierName,
                TierId = p.TierId,
                LevelName = p.LevelName,
                PumpId = p.PumpId
            }).ToList();

            TierlevelModel = new TierLevelModel
            {
                PageCaption    = response.PageCaption,
                Levels         = new ObservableCollection <LevelModel>(tempLevels),
                PumpTierLevels = new ObservableCollection <PumpTierLevelModel>(tempPumpTierLevel),
                Tiers          = new ObservableCollection <TierModel>(tempTier)
            };
        }
        public HttpResponseMessage UpdateTierLevel([FromBody] TierLevelModel model)
        {
            var dateStart = DateTime.Now;

            _performancelog.Debug($"Start,FuelPumpController,UpdateTierLevel,{string.Empty},{dateStart:hh.mm.ss.ffffff}");

            ErrorMessage error;

            var tierLevels = _tierLevelManager.AddUpdateTierLevel(model.PumpIds, model.TierId, model.LevelId, out error);

            if (!string.IsNullOrEmpty(error.MessageStyle.Message))
            {
                return(Request.CreateResponse(HttpStatusCode.Conflict,
                                              new ErrorResponse
                {
                    Error = error.MessageStyle,
                }));
            }
            _performancelog.Debug($"End,FuelPumpController,UpdateTierLevel,{DateTime.Now.Subtract(dateStart).TotalMilliseconds},{DateTime.Now:hh.mm.ss.ffffff}");

            return(Request.CreateResponse(HttpStatusCode.OK, tierLevels));
        }