public async Task <bool> CreateYachtMerchantAccMgt(YachtMerchantAccMgtCreateModel model)
        {
            try
            {
                var userGuid = _workContext.UserGuid;
                var entity   = _mapper.Map <YachtMerchantAqmgts>(model);

                entity.CreatedBy        = userGuid;
                entity.CreatedDate      = DateTime.Now;
                entity.LastModifiedBy   = userGuid;
                entity.LastModifiedDate = DateTime.Now;
                await _dbYachtContext.YachtMerchantAqmgts.AddAsync(entity);

                var flag = await _dbYachtContext.SaveChangesAsync();

                if (flag != 0)
                {
                    return(true);
                }
                return(false);
            }
            catch
            {
                throw;
            }
        }
Beispiel #2
0
 public IActionResult CreateYachtMerchantAccMgt([FromBody] YachtMerchantAccMgtCreateModel createModel)
 {
     try
     {
         var result = _yachtMerchantAccMgtService.CreateYachtMerchantAccMgt(createModel).Result;
         return(Ok(result));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.StackTrace.ToString()));
     }
 }
        public async Task <bool> UpdateYachtMerchantAccMgt(YachtMerchantAccMgtCreateModel model)
        {
            try
            {
                var entity = _dbYachtContext.YachtMerchantAqmgts.AsNoTracking().Where(x => x.Id == model.Id && x.Deleted == false).SingleOrDefault();
                entity = _mapper.Map <YachtMerchantAccMgtCreateModel, YachtMerchantAqmgts>(model, entity);

                entity.LastModifiedBy   = _workContext.UserGuid;
                entity.LastModifiedDate = DateTime.Now;
                _dbYachtContext.YachtMerchantAqmgts.Update(entity);
                var flag = await _dbYachtContext.SaveChangesAsync();

                if (flag != 0)
                {
                    return(true);
                }
                return(false);
            }
            catch
            {
                throw;
            }
        }