public async Task <ActionResult> Manage(PackageTravelStyleViewModel model) { if (this.ModelState.IsValid) { var record = this.Mapper.Map <PackageTravelStyleModel>(model); if (model.Id == 0) { record.SetAuditInfo(0); await this.travelstyle.InsertAsync(record); this.ShowMessage(Messages.SavedSuccessfully); } else { record.UpdateAuditInfo(0); await this.travelstyle.UpdateAsync(record); this.ShowMessage(Messages.UpdateSuccessfully); } return(this.RedirectToRoute(Constants.RouteArea, new { controller = "travelstyle", action = "index", area = Constants.AreaAdmin })); } return(this.View(model)); }
public async Task <ActionResult> Manage(int id) { var model = new PackageTravelStyleViewModel(); if (id > 0) { var record = await this.travelstyle.GetByIdAsync(id); model = this.Mapper.Map <PackageTravelStyleViewModel>(record); } return(this.IsAjaxRequest() ? this.View("_TravelStyle", model) : this.View(model)); }