Пример #1
0
        public ActionResult CreateAndCloseDefectForEventType(Guid eventTypeId)
        {
            var eventType     = GetEventTypeById(eventTypeId);
            var defectService = CurrentAccountDbContext.GetDefectService();
            var user          = GetUserById(CurrentUser.Id);
            var defect        = defectService.CreateAndCloseDefectForEventType(CurrentUser.AccountId, eventType, user);

            CurrentAccountDbContext.SaveChanges();
            return(GetSuccessJsonResponse(new
            {
                defectId = defect.Id,
                eventTypeId = eventType.Id
            }));
        }
Пример #2
0
        public ActionResult Add(AddDefectModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            var service         = CurrentAccountDbContext.GetDefectService();
            var createUser      = GetUserById(CurrentUser.Id);
            var responsibleUser = GetUserById(model.ResponsibleUserId.Value);

            service.CreateDefect(CurrentUser.AccountId, model.Title, createUser, responsibleUser, model.Notes);
            CurrentAccountDbContext.SaveChanges();

            return(GetSuccessJsonResponse());
        }
Пример #3
0
        public ActionResult ChangeStatusDialogPost(ChangeDefectStatusDialogModel model)
        {
            if (model.DefectId == null)
            {
                throw new Exception("model.DefectId == null");
            }
            if (model.Status == null)
            {
                throw new Exception("model.Status == null");
            }
            var defect        = GetDefectById(model.DefectId.Value);
            var defectService = CurrentAccountDbContext.GetDefectService();
            var user          = GetUserById(CurrentUser.Id);

            defectService.ChangeStatus(CurrentUser.AccountId, defect, model.Status.Value, user, model.Comment);
            CurrentAccountDbContext.SaveChanges();
            return(GetSuccessJsonResponse());
        }
Пример #4
0
        public ActionResult CreateDefectDialog(Guid?eventTypeId, Guid?userId, string comment)
        {
            if (eventTypeId == null)
            {
                throw new Exception("eventTypeId == null");
            }
            if (userId == null)
            {
                throw new Exception("userId == null");
            }
            var eventType       = GetEventTypeById(eventTypeId.Value);
            var defectService   = CurrentAccountDbContext.GetDefectService();
            var createUser      = GetUserById(CurrentUser.Id);
            var responsibleUser = GetUserById(userId.Value);
            var defect          = defectService.GetOrCreateDefectForEventType(CurrentUser.AccountId, eventType, createUser, responsibleUser, comment);

            CurrentAccountDbContext.SaveChanges();
            return(GetSuccessJsonResponse(new
            {
                defectId = defect.Id
            }));
        }