Exemple #1
0
        public async Task <IActionResult> Add(long?id)
        {
            if (id == null)
            {
                var s = new CreateEditDto();
                s.Id       = 0;
                s.TenantId = 0;
                return(PartialView("_Add", s));
            }
            // List<BusinessDropDownDto> dtoList = (await _AppService.GetDropDown());
            //ViewData.Add("Business", new Microsoft.AspNetCore.Mvc.Rendering.SelectList(dtoList, "Id", "BusinessName"));
            var dtos = await _couponService.GetByIdAsync((long)id);

            return(PartialView("_Add", dtos));
        }
Exemple #2
0
 public async Task CreateOrEditAsync(CreateEditDto dto)
 {
     dto.TenantId = _AbpSession.TenantId ?? 0;
     if (dto.Type == 0)//通用代金券
     {
         string    sql = $"select id from tbusiness where TenantId={_AbpSession.TenantId} and IsSystemBusiness=1";
         DataTable dt  = _sqlExecuter.ExecuteDataSet(sql).Tables[0];
         dto.BusinessId = (long)dt.Rows[0][0];
     }
     if (dto.Id <= 0)
     {
         await _Repository.InsertAsync(dto.MapTo <Entity.Coupon>());
     }
     else
     {
         await _Repository.UpdateAsync(dto.MapTo <Entity.Coupon>());
     }
 }