Beispiel #1
0
        public TestLogViewModel MakeAsResolve(TestLogViewModel model)
        {
            exceptionService.Execute((m) =>
            {
                if (!model.Validate())
                {
                    return;
                }
                var entity = new TestLog();

                entity                 = testLogRepository.GetById(model.Id);
                entity.IsResolved      = true;
                entity.ResolvedBy      = model.ResolvedBy;
                entity.ResolvedDate    = DateTime.Now;
                entity.ResolvedRemarks = model.ResolvedRemarks;
                testLogRepository.Update(entity);
                model.Message = localizationService.GetLocalizedText("Message.RecordUpdatedSuccessfully", IMSAppConfig.Instance.CurrentLanguage, "Record update succeeded.");
            }, model);
            return(model);
        }
Beispiel #2
0
        public TestLogViewModel SaveTestLog(TestLogViewModel model)
        {
            exceptionService.Execute((m) =>
            {
                if (!model.Validate())
                {
                    return;
                }
                var entity = new TestLog();

                if (model.Id > 0)
                {
                    entity                 = testLogRepository.GetById(model.Id);
                    entity.IsResolved      = model.IsResolved;
                    entity.ResolvedBy      = model.ResolvedBy;
                    entity.ResolvedDate    = model.ResolvedDate;
                    entity.ResolvedRemarks = model.ResolvedRemarks;
                    testLogRepository.Update(entity);
                }
                else
                {
                    model.Date         = DateTime.Now;
                    model.ResolvedDate = null;
                    entity             = AutomapperConfig.Mapper.Map <TestLog>(model);
                    testLogRepository.Insert(entity);
                    model.Id = entity.Id;
                }
                if (model.Id == 0)
                {
                    model.Message = localizationService.GetLocalizedText("Message.RecordSavedSuccessfully", IMSAppConfig.Instance.CurrentLanguage, "Record saved succeeded.");
                }
                else
                {
                    model.Message = localizationService.GetLocalizedText("Message.RecordUpdatedSuccessfully", IMSAppConfig.Instance.CurrentLanguage, "Record update succeeded.");
                }
            }, model);
            return(model);
        }