Beispiel #1
0
        public async Task <IActionResult> Update(Guid id, ExpenseReportDetailViewModel expenseReportDetailViewModel)
        {
            var success = await _expenseReportDetailService.Update(_mapper.Map <ExpenseReportDetail>(expenseReportDetailViewModel));

            if (!success)
            {
                return(BadRequest());
            }

            return(NoContent());
        }
Beispiel #2
0
        public async Task <ActionResult <ExpenseReportDetailViewModel> > Add(ExpenseReportDetailViewModel expenseReportViewModel)
        {
            var imageName = $"{Guid.NewGuid()}_{expenseReportViewModel.Image}";
            await _imageFileService.Upload(expenseReportViewModel.ImageUpload, imageName);

            expenseReportViewModel.Image = imageName;

            var expense = _mapper.Map <ExpenseReportDetail>(expenseReportViewModel);
            var success = await _expenseReportDetailService.Add(expense);

            if (!success)
            {
                return(BadRequest());
            }

            return(NoContent());
        }