Ejemplo n.º 1
0
        public async Task<ActionResult> Create(ReportTypeViewModel processtype)
        {
            if (ModelState.IsValid)
            {
                ReportTypesDto data = new ReportTypesDto
                {
                    Name = processtype.Name,
                    Description = processtype.Description,
                    DaysAfter = processtype.DayAfter,
                    LastUpdatedBy = this.CurrentName,
                };
                var result = await ReportTypesRepository.AddAsync(data);
                if (result == Model.SaveResult.SUCCESS)
                    return RedirectToAction("Index");
            }

            return View(processtype);
        }
Ejemplo n.º 2
0
        public async Task<ActionResult> Edit(int id)
        {
            if (id == 0)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            var processtype = await ReportTypesRepository.SingleAsync(id);
            if (processtype == null)
                return HttpNotFound();
            ReportTypeViewModel bind = new ReportTypeViewModel
            {
                Id = processtype.Id,
                Name = processtype.Name,
                Description = processtype.Description,
                DayAfter = processtype.DaysAfter,
                LastUpdatedBy = processtype.LastUpdatedBy,
                LastUpdate = processtype.LastUpdate,
            };
            return View(bind);
        }