예제 #1
0
        public async Task <HttpResponseMessage> StartCalculation(PromotionViewModel postedViewModel)
        {
            var mapper        = GetMapper();
            var commission    = mapper.Map <Promotion>(postedViewModel);
            var entityCreated = await businessService.PutInProcessQueueAsync(postedViewModel.Year, postedViewModel.Month);

            if (entityCreated.ReturnStatus == false)
            {
                return(CreateErrorResponse(entityCreated));
            }

            return(CreateViewModelResponse(postedViewModel, entityCreated));
        }
예제 #2
0
        public async Task <HttpResponseMessage> Add(PromotionViewModel postedViewModel)
        {
            var mapper         = GetMapper();
            var entityCreating = mapper.Map <Promotion>(postedViewModel);
            var entityCreated  = await businessService.AddPromotionAsync(entityCreating);

            if (entityCreated.ReturnStatus == false)
            {
                return(CreateErrorResponse(entityCreated));
            }

            return(CreateViewModelResponse(postedViewModel, entityCreated));
        }