public async Task <ActionResult> Manage(PackageCurrencyViewModel model) { if (this.ModelState.IsValid) { var record = this.Mapper.Map <CurrencyModel>(model); if (record.Id != 0) { record.UpdateAuditInfo(new Guid(this.HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Sid).Value)); await this.currencyService.UpdateAsync(record); this.ShowMessage(Messages.SavedSuccessfully); } else { record.IsActive = true; record.SetAuditInfo(new Guid(this.HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.Sid).Value)); await this.currencyService.AddAsync(record); this.ShowMessage(Messages.SavedSuccessfully); } return(this.RedirectToRoute(Constants.RouteArea, new { controller = "currency", action = "index", area = Constants.AreaAdmin })); } return(this.View(model)); }
public async Task <ActionResult> Manage(int id) { var model = new PackageCurrencyViewModel(); if (id > 0) { model = this.Mapper.Map <PackageCurrencyViewModel>(await this.currencyService.GetByIdAsync(id)); } model.CountryList = (await this.masterService.GetPackageCountryListAsync(string.Empty, 1, model.Country)).ToSelectList(); return(this.View(model)); }