コード例 #1
0
        public async Task <SharedLookUpResponse> AddComponentAsync(AddTaxType addComponent, int instituteId)
        {
            if (!await iMSDbContext.TaxTypes.AnyAsync(x => x.InstituteId == instituteId && x.Code.ToLowerInvariant() == addComponent.Code.ToLowerInvariant()))
            {
                var componentGroup = new TaxType()
                {
                    CreatedOn   = DateTime.UtcNow,
                    InstituteId = instituteId,
                    Name        = addComponent.Name,
                    Code        = addComponent.Code,
                    Type        = addComponent.Type,
                    Value       = addComponent.Value,
                    Status      = addComponent.Status
                };
                iMSDbContext.TaxTypes.Add(componentGroup);
                await iMSDbContext.SaveChangesAsync();

                return(new SharedLookUpResponse()
                {
                    HasError = false, Message = "Tax Type added successfully"
                });
            }
            else
            {
                return(new SharedLookUpResponse()
                {
                    HasError = true, ErrorType = SharedLookUpResponseType.Code, Message = "Tax Type with same code is already existed"
                });
            }
        }
コード例 #2
0
 public async Task <IActionResult> AddGroupAsync([FromBody] AddTaxType addGroupAc)
 {
     if (string.IsNullOrEmpty(addGroupAc.Name.Trim()))
     {
         return(Ok(new SharedLookUpResponse()
         {
             HasError = true,
             ErrorType = SharedLookUpResponseType.Name,
             Message = "Tax Type name can't be null or empty"
         }));
     }
     else if (string.IsNullOrEmpty(addGroupAc.Code.Trim()))
     {
         return(Ok(new SharedLookUpResponse()
         {
             HasError = true,
             ErrorType = SharedLookUpResponseType.Name,
             Message = "Tax Type code can't be null or empty"
         }));
     }
     else
     {
         return(Ok(await taxTypeManagementRepository.AddComponentAsync(addGroupAc, await GetUserCurrentSelectedInstituteIdAsync())));
     }
 }