Ejemplo n.º 1
0
        public ActionResult Create()
        {
            ProcessResultViewModel bind = new ProcessResultViewModel();
            bind.ProcessType = ProcessTypesRepository.GetAll();

            return View(bind);
        }
Ejemplo n.º 2
0
        public async Task<ActionResult> Create(ProcessResultViewModel model)
        {
            if (ModelState.IsValid)
            {
                MSTProcessResultDto pro = new MSTProcessResultDto()
                {
                    ProcessTypeId = model.ProcessTypeId,
                    Value = model.Value,
                    Description = model.Description,
                    LastUpdatedBy = CurrentName
                };
                var result = await ProcessResultRespository.AddAsync(pro);

                if (result == Model.SaveResult.SUCCESS)
                    return RedirectToAction("Index");
            }

            model.ProcessType = ProcessTypesRepository.GetAll();
            return View(model);
        }
Ejemplo n.º 3
0
        public async Task<ActionResult> Edit(int id, ProcessResultViewModel model)
        {
            if (ModelState.IsValid)
            {
                var status = new MSTProcessResultDto()
                {
                    Id = id,
                    ProcessTypeId = model.ProcessTypeId,
                    Value = model.Value,
                    Description = model.Description,
                    LastUpdatedBy = CurrentName,
                };
                var result = await ProcessResultRespository.UpdateAsync(status);

                if (result == Model.SaveResult.SUCCESS)
                    return RedirectToAction("Index");
            }

            IEnumerable<MSTProcessTypesDto> processType = await ProcessTypesRepository.GetAllAsync();
            model.ProcessType = processType;
            return View(model);
        }
Ejemplo n.º 4
0
        public async Task<ActionResult> Edit(int id)
        {
            if (id == 0)
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);

            MSTProcessResultDto pro = await ProcessResultRespository.SingleAsync(id);
            IEnumerable<MSTProcessTypesDto> processType = await ProcessTypesRepository.GetAllAsync();
            if (pro == null)
                return HttpNotFound();

            ProcessResultViewModel bind = new ProcessResultViewModel
            {
                Id = id,
                ProcessTypeId = pro.ProcessTypeId,
                Value = pro.Value,
                Description = pro.Description,
                LastUpdatedBy = pro.LastUpdatedBy,
                LastUpdate = pro.LastUpdate,
                ProcessType = processType,
            };
            return View(bind);
        }