public async Task <ActionResult> Edit(int id, JobViewModel vm) { var dto = new GetJobById().ExecuteQuery(id); await new UpdateJobCommandHandler().HandleAsync( new UpdateJobCommand() { Id = id, Title = vm.Title, ShortDescription = vm.ShortDescription, Description = vm.Description, City = vm.City, Province = vm.SelectedProvince, JobType = vm.SelectedJobType, ClosingDate = vm.ClosingDate, YearOfExperince = vm.YearsOfExperince, Hours = vm.Hours, Rate = vm.Rate, Filled = vm.Filled, Active = vm.Active }).ConfigureAwait(false); vm.InitializeLists(); return(View(vm)); }
public async Task <ActionResult> Add(JobViewModel vm) { await new AddJobCommandHandler().HandleAsync( new AddJobCommand() { Title = vm.Title, ShortDescription = vm.ShortDescription, Description = vm.Description, City = vm.City, Province = vm.SelectedProvince, JobType = vm.SelectedJobType, ClosingDate = vm.ClosingDate, YearOfExperince = vm.YearsOfExperince, Hours = vm.Hours, Rate = vm.Rate }).ConfigureAwait(false); return(RedirectToAction(Navigation.Jobs.Index, Navigation.Jobs.Controller)); vm.InitializeLists(); return(View(vm)); }
public ActionResult Edit(int id) { var dto = new GetJobById().ExecuteQuery(id); var vm = new JobViewModel() { Id = dto.Id, Title = dto.Title, ShortDescription = dto.ShortDescription, Description = dto.Description, City = dto.City, SelectedProvince = dto.Province, SelectedJobType = dto.JobType, YearsOfExperince = dto.YearsOfExperience, ClosingDate = dto.ClosingDate.HasValue ? dto.ClosingDate.Value.ToString("dd-MM-yyyy") : string.Empty, Hours = dto.Hours, Rate = dto.Rate, Active = dto.Active, Filled = dto.Filled, }; vm.InitializeLists(); return(View(vm)); }