public MDRDocument BizAction(MDRDocumentDto inputData)
        {
            if (string.IsNullOrWhiteSpace(inputData.Title))
            {
                AddError("title is Required.");
            }
            if (string.IsNullOrWhiteSpace(inputData.FolderName))
            {
                AddError("Folder Name is invalied.");
            }

            var defaultStatus = _dbStatusAccess.GetDefaultStatus(inputData.ProjectId);

            if (defaultStatus == null)
            {
                AddError("Default MDR Status Not Exit.");
            }

            IStatusGeneric <MDRDocument> desStatus = null;

            if (!HasErrors)
            {
                desStatus = MDRDocument.CreateMDRDocument(inputData.Title, inputData.Description,
                                                          inputData.WorkPackageId, inputData.Code, defaultStatus.Id, inputData.ProjectId, inputData.Type);

                var mdr = desStatus.Result;
                mdr.CreateMDRStatus("CREATE MDR", defaultStatus.Id, inputData.FolderName);

                _dbAccess.Add(desStatus.Result);
                CombineErrors(desStatus);
            }

            return(HasErrors ? null : desStatus.Result);
        }
Пример #2
0
 public void Add(MDRDocument mDRDocument)
 {
     _context.Add <MDRDocument>(mDRDocument);
 }