Пример #1
0
        public ActionResult Edit(UnitTestEditModel model)
        {
            model.UnitTest = GetUnitTestById(model.Id);

            if (!ModelState.IsValid)
            {
                View(model);
            }

            var updateData = new UpdateUnitTestRequestData()
            {
                NoSignalColor = model.NoSignalColor.GetSelectedOne(),
                ActualTime    = TimeSpanHelper.GetSeconds(model.ActualTime),
                DisplayName   = model.DisplayName,
                ComponentId   = model.ComponentId,
                PeriodSeconds = model.PeriodSeconds,
                UnitTestId    = model.Id,
                SystemName    = model.UnitTest.SystemName
            };
            var dispatcher = GetDispatcherClient();
            var response   = dispatcher.UpdateUnitTest(CurrentUser.AccountId, updateData);

            if (response.Success)
            {
                return(RedirectToAction("ResultDetails", new { id = model.Id }));
            }
            SetCommonError(response.ErrorMessage);
            return(View(model));
        }
Пример #2
0
        public ActionResult Edit(Guid id)
        {
            var unitTest = GetUnitTestById(id);

            var model = new UnitTestEditModel()
            {
                Id            = unitTest.Id,
                ComponentId   = unitTest.Component.Id,
                Date          = unitTest.Bulb.EndDate,
                DisplayName   = unitTest.DisplayName,
                IsDeleted     = unitTest.IsDeleted,
                Message       = unitTest.Bulb.Message,
                PeriodSeconds = unitTest.PeriodSeconds,
                ActualTime    = TimeSpanHelper.FromSeconds(unitTest.ActualTimeSecs),
                NoSignalColor = ColorStatusSelectorValue.FromColor(unitTest.NoSignalColor),
                Status        = unitTest.Bulb.Status,
                UnitTestType  = unitTest.Type,
                UnitTest      = unitTest
            };

            return(View(model));
        }