public static Result <Module> Create(string title, string excerpt, string instructor, string imageUrl, List <ObjectId> assistantProfessorIds, ObjectId?instructorId, List <SupportMaterial> supportMaterials, List <Requirement> requirements, List <ValueObjects.Tag> tags, bool published, Duration duration, List <Subject> subjects, string certificateUrl, List <ObjectId> tutorsIds, List <ObjectId> extraInstructorIds, string storeUrl = "", string ecommerceUrl = "", ModuleGradeTypeEnum moduleGradeType = ModuleGradeTypeEnum.SubjectsLevel, int?validFor = null) { if (title.Length > 200) { return(Result.Fail <Module>($"Tamanho máximo do título do módulo é de 200 caracteres. ({title})")); } var module = new Module() { Id = ObjectId.GenerateNewId(), Title = title, Excerpt = excerpt, Instructor = instructor, ImageUrl = imageUrl, AssistantProfessorIds = assistantProfessorIds, InstructorId = instructorId, SupportMaterials = supportMaterials, Requirements = requirements, Tags = tags, Published = published, Duration = duration, Subjects = subjects, CertificateUrl = certificateUrl, TutorsIds = tutorsIds, ExtraInstructorIds = extraInstructorIds, StoreUrl = storeUrl, EcommerceUrl = ecommerceUrl, ModuleGradeType = moduleGradeType, ValidFor = validFor }; return(Result.Ok(module)); }
public static Result <ModuleDraft> Create( ObjectId moduleId, string title, string excerpt, string imageUrl, bool published, ObjectId?instructorId, string instructor, string instructorMiniBio, string instructorImageUrl, Duration duration, Duration videoDuration = null, string videoUrl = "", string certificateUrl = "", string storeUrl = "", string ecommerceUrl = "", bool createInEcommerce = false, List <Tag> tags = null, List <ObjectId> tutorsIds = null, List <ObjectId> extraInstructorIds = null, ModuleGradeTypeEnum moduleGradeType = ModuleGradeTypeEnum.SubjectsLevel ) { var module = new ModuleDraft() { Id = ObjectId.GenerateNewId(), ModuleId = moduleId, Title = title, Excerpt = excerpt, InstructorId = instructorId.HasValue ? instructorId : ObjectId.Empty, Instructor = instructor, InstructorMiniBio = instructorMiniBio, ExtraInstructorIds = extraInstructorIds, ImageUrl = imageUrl, InstructorImageUrl = instructorImageUrl, Published = published, Duration = duration, Tags = tags, CertificateUrl = certificateUrl, TutorsIds = tutorsIds, StoreUrl = storeUrl, EcommerceUrl = ecommerceUrl, VideoDuration = videoDuration, VideoUrl = videoUrl, CreateInEcommerce = createInEcommerce, DraftPublished = false, ModuleGradeType = moduleGradeType }; return(Result.Ok(module)); }
public static Result <Module> Create(string title, string excerpt, string instructorId, string instructor, string instructorMiniBio, string imageUrl, string instructorImageUrl, bool published, Duration duration, List <ValueObjects.Tag> tags = null, string certificateUrl = "", List <ObjectId> tutorsIds = null, List <ObjectId> extraInstructorIds = null, string storeUrl = "", string ecommerceUrl = "", ModuleGradeTypeEnum moduleGradeType = ModuleGradeTypeEnum.SubjectsLevel, int?validFor = null) { var module = new Module() { Id = ObjectId.GenerateNewId(), Title = title, Excerpt = excerpt, InstructorId = string.IsNullOrEmpty(instructorId) ? ObjectId.Empty : ObjectId.Parse(instructorId), Instructor = instructor, InstructorMiniBio = instructorMiniBio, ImageUrl = imageUrl, InstructorImageUrl = instructorImageUrl, Published = published, Duration = duration, Tags = tags, CertificateUrl = certificateUrl, TutorsIds = tutorsIds, ExtraInstructorIds = extraInstructorIds, StoreUrl = storeUrl, EcommerceUrl = ecommerceUrl, ModuleGradeType = moduleGradeType, ValidFor = validFor }; return(Result.Ok(module)); }