Ejemplo n.º 1
0
        public async Task <IActionResult> Create([FromBody] CreateMainCurrencyViewModel vm)
        {
            var result = await _services.CreateMainCurrencyAsync(_mapper.Map <CreateCurrencyDTO>(vm));

            if (result.IsValid)
            {
                await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Insert, Tables.DimCurrency);

                return(CreatedAtRoute("GetCurrency", new { version = "1.0", controller = "Currency", id = result.Result }, vm));
            }
            return(UnprocessableEntity(result.ErrorsList));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Update([FromBody] CreateMainCurrencyViewModel vm)
        {
            var result = await _services.UpdateAsync(_mapper.Map <CreateCurrencyDTO>(vm));

            if (result.IsValid)
            {
                await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Update, Tables.DimCurrency);

                return(NoContent());
            }
            return(BadRequest(result.ErrorsList));
        }
Ejemplo n.º 3
0
 public async Task<IActionResult> CreateConfirmed(CreateMainCurrencyViewModel vm)
 {
     if (ModelState.IsValid)
     {                
         var result = await _services.CreateMainCurrencyAsync(_mapper.Map<CreateCurrencyDTO>(vm));
         if (result.IsValid)
         {
             await _systemAuditService.AuditAsync(User.GetEmail(), _accessor.GetIp(), Operations.Insert, Tables.DimCurrency);
             return RedirectToAction("Index");
         }
         TempData["ErrorsList"] = result.ErrorsList;
     }
     return View(vm);
 }