Exemple #1
0
        public ActionResult Edit(Guid id)
        {
            var repository = CurrentAccountDbContext.GetDefectRepository();
            var defect     = repository.GetById(id);
            var model      = new EditDefectModel()
            {
                Id         = id,
                Title      = defect.Title,
                Notes      = defect.Notes,
                UserId     = defect.ResponsibleUserId,
                DefectCode = defect.GetCode()
            };

            return(View(model));
        }
Exemple #2
0
        public ActionResult Show(Guid id)
        {
            var repository = CurrentAccountDbContext.GetDefectRepository();
            var defect     = repository.GetById(id);
            var model      = new ShowDefectModel()
            {
                Defect = defect
            };

            if (defect.EventTypeId.HasValue)
            {
                model.EventType = GetEventTypeById(defect.EventTypeId.Value);
            }
            return(View(model));
        }
Exemple #3
0
        public ActionResult Edit(EditDefectModel model)
        {
            var repository = CurrentAccountDbContext.GetDefectRepository();
            var defect     = repository.GetById(model.Id);

            if (ModelState.IsValid)
            {
                defect.Title             = model.Title;
                defect.Notes             = model.Notes;
                defect.ResponsibleUserId = model.UserId;
                CurrentAccountDbContext.SaveChanges();
                return(RedirectToAction("Show", new { id = model.Id }));
            }
            model.DefectCode = defect.GetCode();
            return(View(model));
        }