Beispiel #1
0
        public ActionResult Create()
        {
            FAReportViewModel bind = new FAReportViewModel();

            var origins = OriginRepository.GetAll();
            var types = ReportTypeRepository.GetAll();
            bind.Origins = origins;
            bind.ReportTypes = types;
            return View(bind);
        }
Beispiel #2
0
        public async Task<ActionResult> Create(FAReportViewModel report)
        {
            if (ModelState.IsValid)
            {
                MSTFarReportDto data = new MSTFarReportDto
                {
                    OriginId = report.OriginId,
                    ReportTypeId = report.ReportTypeId,
                    Required = report.Required,
                    Description = report.Description,
                    LastUpdatedBy = this.CurrentName,
                };
                var result = await FarReportRepository.AddAsync(data);
                if (result == Model.SaveResult.SUCCESS)
                    return RedirectToAction("Index");
            }

            return View(report);
        }
Beispiel #3
0
        public async Task<ActionResult> Edit(int id)
        {
            if (id == 0)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            var report = await FarReportRepository.SingleAsync(id);
            if (report == null)
                return HttpNotFound();
            FAReportViewModel bind = new FAReportViewModel
            {
                Id = report.Id,
                OriginId = report.OriginId,
                ReportTypeId = report.ReportTypeId,
                Required = report.Required,
                Description = report.Description,
                LastUpdatedBy = report.LastUpdatedBy,
                LastUpdate = report.LastUpdate,
            };
            var origins = await OriginRepository.GetAllAsync();
            var types = await ReportTypeRepository.GetAllAsync();
            bind.Origins = origins;
            bind.ReportTypes = types;

            return View(bind);
        }