Ejemplo n.º 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);
        }
Ejemplo n.º 2
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);
        }