Пример #1
0
        public bool UpdateEvisaMerchant(EVisaMerchantCreateUpdateModel model)
        {
            var result = false;
            var entity = new VisaMerchants();
            var query  = _dbEvisaContext.VisaMerchants.Where(x => x.Deleted == false && x.Id == model.Id);

            if (query.Count() > 0)
            {
                entity = query.FirstOrDefault();
            }
            else
            {
                return(result);
            }
            entity = _mapper.Map <EVisaMerchantCreateUpdateModel, VisaMerchants>(model, entity);
            entity.LastModifiedBy   = _workContext.UserGuid;
            entity.LastModifiedDate = DateTime.Now;
            var status = _dbEvisaContext.VisaMerchants.Update(entity);

            _dbEvisaContext.SaveChanges();

            if (status.State == EntityState.Unchanged)
            {
                result = true;
            }

            return(result);
        }
Пример #2
0
        public IActionResult UpdateEVisaMerchant(EVisaMerchantCreateUpdateModel parameters)
        {
            var response = _eVisaMerchantService.UpdateEvisaMerchant(parameters);

            if (response)
            {
                return(Ok(response));
            }
            return(BadRequest());
        }
Пример #3
0
        public bool CreateEvisaMerchant(EVisaMerchantCreateUpdateModel model)
        {
            var result = false;
            var entity = new VisaMerchants();

            entity                  = _mapper.Map <EVisaMerchantCreateUpdateModel, VisaMerchants>(model, entity);
            entity.UniqueId         = UniqueIDHelper.GenerateRandomString(12);
            entity.CountryVisa      = model.Country;
            entity.CreatedBy        = _workContext.UserGuid;
            entity.CreatedDate      = DateTime.Now;
            entity.LastModifiedBy   = _workContext.UserGuid;
            entity.LastModifiedDate = DateTime.Now;
            var status = _dbEvisaContext.VisaMerchants.Add(entity);

            _dbEvisaContext.SaveChanges();

            if (status.State == EntityState.Unchanged)
            {
                result = true;
            }

            return(result);
        }