예제 #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);
        }