public void SaveNewPresentation(PreCreatedPresentation presentation, User user) { if (user == null) { throw new UserHaveNotRulesException(); } if (new UserActions().IsUserExist(user)) { throw new UserNotExistException(); } if (presentation == null) { throw new PresentationNullDataException(); } if (string.IsNullOrEmpty(presentation.Name)) { throw new PresentationWrongNameException(); } try { var createdPresentation = FormNewPresentation(presentation, user.UserId); TrySavePresentation(createdPresentation); } catch (Exception ex) { throw new DataBaseBaseException(ex.Message, ex); } }
public Presentation FormNewPresentation(PreCreatedPresentation presentationData, Guid userId) { if (presentationData == null) { return(null); } return(new Presentation { CreateDate = DateTime.Now, Description = presentationData.Description, Name = presentationData.Name, PresentationId = Guid.NewGuid(), Tags = presentationData.Tags, User = new UserActions().GetUserById(userId) }); }