public IResponseDTO EditWorkshopNotifications(WorkshopNotificationsVM model)
        {
            try
            {
                var DbWorkshopNotifications = _mapper.Map <WorkshopNotifications>(model);
                var entityEntry             = _WorkshopNotificationsRepositroy.Update(DbWorkshopNotifications);


                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 " + string.Format("{0} - {1} ", ex.Message, ex.InnerException != null ? ex.InnerException.FullMessage() : "");
            }

            return(_response);
        }
Beispiel #2
0
        public IResponseDTO EditMarketFollow(MarketFollowVM model)
        {
            try
            {
                var DbMarketFollow = _mapper.Map <MarketFollow>(model);
                var entityEntry    = _MarketFollowRepositroy.Update(DbMarketFollow);


                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);
        }
Beispiel #3
0
        public IResponseDTO EditDepartment(DepartmentModel model)
        {
            try
            {
                var DbDepartment = _mapper.Map <Department>(model);
                var entityEntry  = _departmentRepositroy.Update(DbDepartment);


                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);
        }
Beispiel #4
0
        public IResponseDTO EditAdvertisementOpen(AdvertisementOpenVM model)
        {
            try
            {
                var DbAdvertisementOpen = _mapper.Map <AdvertisementOpen>(model);
                var entityEntry         = _AdvertisementOpenRepositroy.Update(DbAdvertisementOpen);

                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);
        }
Beispiel #5
0
        public IResponseDTO EditContactUs(ContactUsVM model)
        {
            try
            {
                var DbContactUs = _mapper.Map <ContactUs>(model);
                var entityEntry = _ContactUsRepositroy.Update(DbContactUs);
                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);
        }
Beispiel #6
0
        public IResponseDTO EditOrder(OrderVM model)
        {
            try
            {
                int OldStuts    = (int)_OrderRepositroy.GetFirst(x => x.OrderId == model.OrderId).Status;
                var DbOrder     = _mapper.Map <Order>(model);
                var entityEntry = _OrderRepositroy.Update(DbOrder);
                if (OldStuts != model.Status)
                {
                    bool _notification = SendNotification(model);
                }
                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 " + string.Format("{0} - {1} ", ex.Message, ex.InnerException != null ? ex.InnerException.FullMessage() : "");
            }

            return(_response);
        }
        public IResponseDTO EditAdvertisement(AdvertisementIncloudVM model)
        {
            try
            {
                var _AdvertisementCategory = model.AdvertisementCategory?.ToList();
                var _AdvertisementCity     = model.AdvertisementCity?.ToList();
                model.AdvertisementCategory = null;
                model.AdvertisementCity     = null;
                var DbAdvertisement = _mapper.Map <Advertisement>(model);
                var entityEntry     = _AdvertisementRepositroy.Update(DbAdvertisement);
                var _ACategory      = _AdvertisementCategoryRepositroy.Get(x => x.AdsId == model.AdsId).ToList();
                if (_ACategory != null && _ACategory.Count > 0)
                {
                    _AdvertisementCategoryRepositroy.RemoveRange(_ACategory);
                }
                if (_AdvertisementCategory != null && _AdvertisementCategory.Count > 0)
                {
                    _AdvertisementCategory.ForEach(x => x.AdsId = model.AdsId);
                    _AdvertisementCategoryRepositroy.AddRange(_mapper.Map <List <AdvertisementCategory> >(_AdvertisementCategory));
                }
                var _ACity = _AdvertisementCityRepositroy.Get(x => x.AdsId == model.AdsId).ToList();
                if (_ACity != null && _ACity.Count > 0)
                {
                    _AdvertisementCityRepositroy.RemoveRange(_ACity);
                }
                if (_AdvertisementCity != null && _AdvertisementCity.Count > 0)
                {
                    _AdvertisementCity.ForEach(x => x.AdsId = model.AdsId);
                    _AdvertisementCityRepositroy.AddRange(_mapper.Map <List <AdvertisementCity> >(_AdvertisementCity));
                }
                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);
        }