Classe responsável por representar ideias
Inheritance: BaseEntity
        public ActionResult Edit(Idea idea)
        {
            if (string.IsNullOrEmpty(idea.Title) || string.IsNullOrEmpty(idea.Description))
            {
                IdeaFilter ideaFilter = new IdeaFilter()
                {
                    Id = idea.Id
                };

                Idea ideaBd = _IdeaService.GetIdea(ideaFilter);

                if (idea == null)
                    return View();

                ViewBag.PETianos = _PETianoService.GetPETianos().Select(petiano => new SelectListItem
                {
                    Text = petiano.Name + "(" + petiano.Login + ")",
                    Value = petiano.Id.ToString()
                });

                return View(ideaBd);
            }
            else
            {
                _IdeaService.EditIdea(idea);

                return RedirectToAction("Index");
            }
        }
        public ActionResult Create(Idea idea)
        {
            if (string.IsNullOrEmpty(idea.Title) || string.IsNullOrEmpty(idea.Description))
            {
                ViewBag.PETianos = _PETianoService.GetPETianos().Select(petiano => new SelectListItem
                {
                    Text = petiano.Name + "(" + petiano.Login + ")",
                    Value = petiano.Id.ToString()
                });

                return View();
            }

            _IdeaService.CreateIdea(idea);

            return RedirectToAction("Index");
        }
Esempio n. 3
0
 public void EditIdea(Idea idea)
 {
     using (IBusinessProvider provider = base.CreateBusinessProvider())
     using (IIdeaBusinessProvider prov = provider.CreateIdeaBusinessProvider())
         prov.EditIdea(idea);
 }
 public void EditIdea(Idea idea)
 {
     using (IDataProvider provider = base.CreateDataProvider())
     using (IIdeaRepository repository = provider.CreateIdeaRepository())
         repository.Update(idea);
 }