Example #1
0
        public static StoreLineManager MapToClient(StoreLineManager lineManager)
        {
            StoreLineManager singleLineManager = new StoreLineManager
            {
                Id              = lineManager.Id,
                StoreId         = lineManager.StoreId,
                LineManagerId   = lineManager.LineManagerId,
                LineManagerUser = lineManager.LineManagerUser != null?MapToClient(lineManager.LineManagerUser) : null
            };

            return(singleLineManager);
        }
Example #2
0
        public JsonResult DeleteLineManager(StoreLineManager lineManager)
        {
            List <StoreLineManager> onlyLineManager = new List <StoreLineManager>();

            using (Repository <StoreLineManager> repository = new Repository <StoreLineManager>())
            {
                repository.DeleteByID(lineManager.Id, GetLoggedinUserInfo().UserId);


                onlyLineManager = GetLineManager(lineManager.StoreId);

                return(Json(onlyLineManager, JsonRequestBehavior.AllowGet));
            }
        }
Example #3
0
        public JsonResult SaveLineManager(StoreLineManager lineManager)
        {
            List <StoreLineManager> onlyLineManager = new List <StoreLineManager>();

            lineManager.UserId = GetLoggedinUserInfo().UserId;

            using (Repository <StoreLineManager> repository = new Repository <StoreLineManager>())
            {
                repository.Insert(lineManager);
                repository.Commit();
                onlyLineManager = GetLineManager(lineManager.StoreId);

                return(Json(onlyLineManager, JsonRequestBehavior.AllowGet));
            }
        }
Example #4
0
        public static List <StoreLineManager> MapToClient(List <StoreLineManager> listStoreLineManager)
        {
            List <StoreLineManager> onlyStoreLineManagers = new List <StoreLineManager>();

            listStoreLineManager.ForEach(s =>
            {
                if (s.Active == true)
                {
                    StoreLineManager singleStoreLineManager = ModelMapper.MapToClient(s);
                    onlyStoreLineManagers.Add(singleStoreLineManager);
                }
            });

            return(onlyStoreLineManagers);
        }
Example #5
0
        public List <StoreLineManager> GetLineManager(long storeId)
        {
            List <StoreLineManager> onlyLineManager = new List <StoreLineManager>();

            using (Repository <StoreLineManager> repository = new Repository <StoreLineManager>())
            {
                Expression <Func <StoreLineManager, bool> > lambda;

                lambda = (x => x.Active == true && x.StoreId == storeId);
                List <StoreLineManager> storeLineManagers = repository.GetByQuery(lambda).ToList();

                storeLineManagers.ForEach(u =>
                {
                    StoreLineManager LineManager = ModelMapper.MapToClient(u);
                    onlyLineManager.Add(LineManager);
                });

                return(onlyLineManager);
            }
        }