Exemplo n.º 1
0
        public void Handle(DeleteProjectTypeCommand command)
        {
            var projectType = _projectTypeRepository.Get(command.ProductTypeId);

            Guard.IsNotNull(projectType, "projectType");
            _projectTypeRepository.Delete(projectType);
        }
Exemplo n.º 2
0
        public void Handle(UpdateProjectCommand command)
        {
            var project = _projectRepository.Load(command.ProjectId);

            Guard.IsNotNull(project, "project");
            if (command.ProjectTypeId != null)
            {
                var projectType = _projectTypeRepository.Get(int.Parse(command.ProjectTypeId.ToString()));
                Guard.IsNotNull(projectType, "projectType");
                project.ProjectType = projectType;
            }
            if (!string.IsNullOrEmpty(command.ProjectName))
            {
                project.ProjectName = command.ProjectName;
            }
            if (!string.IsNullOrEmpty(command.ProjectImg))
            {
                project.ProjectImg = command.ProjectImg;
            }
            if (!string.IsNullOrEmpty(command.StandardProjectImg))
            {
                project.StandardProjectImg = command.StandardProjectImg;
            }
            if (!string.IsNullOrEmpty(command.SmallProjectImg))
            {
                project.SmallProjectImg = command.SmallProjectImg;
            }
            if (!string.IsNullOrEmpty(command.WebSite))
            {
                project.WebSite = command.WebSite;
            }



            if (string.IsNullOrEmpty(command.Introduction))
            {
                if (!string.IsNullOrEmpty(command.Content))
                {
                    project.Introduction = "   " + Utils.CutStringBySuffix(Utils.RemoveHtml(command.Content), 0, 300, "...");
                }
            }
            else
            {
                project.Introduction = HttpUtility.HtmlEncode(command.Introduction);
            }

            if (command.IsShow != null)
            {
                project.IsShow = bool.Parse(command.IsShow.ToString());
            }
            if (!string.IsNullOrEmpty(command.Content))
            {
                project.Content = HttpUtility.HtmlEncode(command.Content);
            }
            if (command.Sort != null && command.Sort > 0)
            {
                project.Sort = command.Sort;
            }
            project.LastDateTime = DateTime.Now;
            _projectRepository.SaveOrUpdate(project);
        }
Exemplo n.º 3
0
 public ProjectType GetProjectType(int Id)
 {
     return(_projectTypeRepository.Get(Id));
 }