예제 #1
0
        public IResponseDTO UpdateMarketToken(DTO.MarketTokenDTO marketToken)
        {
            try
            {
                var model = _MarketRepositroy.Find(marketToken.MarketId);
                model.Token = marketToken.Token;
                var DbMarket    = _mapper.Map <Market>(model);
                var entityEntry = _MarketRepositroy.Update(DbMarket);


                int save = _unitOfWork.Commit();

                if (save == 200)
                {
                    _response.Data     = model;
                    _response.IsPassed = true;
                    _response.Message  = "Ok";
                }
                else
                {
                    _response.Data     = null;
                    _response.IsPassed = false;
                    _response.Message  = "Not saved";
                }
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + ex.Message;
            }
            return(_response);
        }
        public IResponseDTO GetByIDCustomer(object id)
        {
            try
            {
                var Customers = _CustomerRepositroy.Find(id);


                var CustomersList = _mapper.Map <CustomerVM>(Customers);
                _response.Data     = CustomersList;
                _response.IsPassed = true;
                _response.Message  = "Done";
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + ex.Message;
            }
            return(_response);
        }
예제 #3
0
        public IResponseDTO GetByIDDepartment(int?id)
        {
            var departments = _departmentRepositroy.Find(id);


            var departmentsList = _mapper.Map <List <DepartmentModel> >(departments);

            _response.Data     = departmentsList;
            _response.IsPassed = true;
            _response.Message  = "Done";
            return(_response);
        }
예제 #4
0
        public IResponseDTO GetCustomerByWorkShopId(Guid id)
        {
            try
            {//GetCustomerByWorkShopId
                var Chats = _ChatRepositroy.Filter(x => x.WorkShopId == id).ToList();


                List <ResponseChat> Wrokshops = new List <ResponseChat>();
                foreach (var customerChat in Chats)
                {
                    if (customerChat.CustomerId != null)
                    {
                        var customerHasChat = _CustomerRepositroy.Find(customerChat.CustomerId);
                        var chat            = new ResponseChat();
                        chat.Content      = customerChat.Content;
                        chat.CreationDate = customerChat.CreationDate;
                        chat.CountUnRead  = _ChatRepositroy.Get(x => x.WorkShopId == id && x.IsRead == false).Count();
                        chat.CustomerName = customerHasChat.Name;
                        chat.ImageUrl     = customerHasChat.ImageUrl;
                        chat.CustomerId   = customerHasChat.CustomerId;

                        Wrokshops.Add(chat);
                    }
                }

                var result = Wrokshops.GroupBy(x => x.CustomerId)
                             .Select(x => x.OrderByDescending(y => y.CreationDate).First());

                _response.Data = result.Select(x => new
                {
                    Content      = x.Content,
                    CountUnRead  = x.CountUnRead,
                    CreationDate = x.CreationDate,
                    CustomerName = x.CustomerName,
                    CustomerId   = x.CustomerId,
                    ImageUrl     = x.ImageUrl,
                });
                _response.IsPassed = true;
                _response.Message  = "Done";
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + string.Format("{0} - {1} ", ex.Message, ex.InnerException != null ? ex.InnerException.FullMessage() : "");
            }
            return(_response);
        }
        public IResponseDTO GetByIDCountry(object id)
        {
            try
            {
                var Countrys = _CountryRepositroy.Find(id);

                var CountrysList = _mapper.Map <CountryVM>(Countrys);
                _response.Data     = CountrysList;
                _response.IsPassed = true;
                _response.Message  = "Done";
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + string.Format("{0} - {1} ", ex.Message, ex.InnerException != null ? ex.InnerException.FullMessage() : "");
            }
            return(_response);
        }
예제 #6
0
        public IResponseDTO GetByIDContactUsMarket(object id)
        {
            try
            {
                var ContactUsMarkets = _ContactUsMarketRepositroy.Find(id);

                var ContactUsMarketsList = _mapper.Map <ContactUsMarketVM>(ContactUsMarkets);
                _response.Data     = ContactUsMarketsList;
                _response.IsPassed = true;
                _response.Message  = "Done";
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + ex.Message;
            }
            return(_response);
        }
예제 #7
0
        public IResponseDTO GetByIDPrivacy(object id)
        {
            try
            {
                var Privacys = _PrivacyRepositroy.Find(id);

                var PrivacysList = _mapper.Map <PrivacyVM>(Privacys);
                _response.Data     = PrivacysList;
                _response.IsPassed = true;
                _response.Message  = "Done";
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + ex.Message;
            }
            return(_response);
        }
        public IResponseDTO GetByIDAboutUs(object id)
        {
            try
            {
                var AboutUss = _AboutUsRepositroy.Find(id);

                var AboutUssList = _mapper.Map <AboutUsVM>(AboutUss);
                _response.Data     = AboutUssList;
                _response.IsPassed = true;
                _response.Message  = "Done";
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + ex.Message;
            }
            return(_response);
        }
예제 #9
0
        public IResponseDTO GetByIDWorkshopRate(object id)
        {
            try
            {
                var WorkshopRates = _WorkshopRateRepositroy.Find(id);


                var WorkshopRatesList = _mapper.Map <WorkshopRateVM>(WorkshopRates);
                _response.Data     = WorkshopRatesList;
                _response.IsPassed = true;
                _response.Message  = "Done";
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + string.Format("{0} - {1} ", ex.Message, ex.InnerException != null ? ex.InnerException.FullMessage() : "");
            }
            return(_response);
        }
        public IResponseDTO GetByIDAdvertisement(object id)
        {
            try
            {
                var Advertisements = _AdvertisementRepositroy.Find(id);


                var AdvertisementsList = _mapper.Map <AdvertisementVM>(Advertisements);
                _response.Data     = AdvertisementsList;
                _response.IsPassed = true;
                _response.Message  = "Done";
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + ex.Message;
            }
            return(_response);
        }
예제 #11
0
        public IResponseDTO GetByIDMarketFollow(object id)
        {
            try
            {
                var MarketFollows = _MarketFollowRepositroy.Find(id);


                var MarketFollowsList = _mapper.Map <MarketFollowVM>(MarketFollows);
                _response.Data     = MarketFollowsList;
                _response.IsPassed = true;
                _response.Message  = "Done";
            }
            catch (Exception ex)
            {
                _response.Data     = null;
                _response.IsPassed = false;
                _response.Message  = "Error " + ex.Message;
            }
            return(_response);
        }