Пример #1
0
        public ActionResult Create(Idea idea)
        {
            if (ModelState.IsValid)
            {
                _repo.Add(idea);
                return RedirectToAction("Index");
            }

            return View(idea);
        }
Пример #2
0
 public IdeaTableEntity(Idea suggest)
 {
     RowKey = suggest.Id.ToString();
     PartitionKey = "Suggests";
     CreationDate = suggest.CreationDate;
     Title = suggest.Title;
     Detail = suggest.Detail;
     Author = suggest.Author;
     VoteId = suggest.Votes.Id;
     TagIds = suggest.Tags.Any() ? string.Join(",", suggest.Tags.Select(t => t.Id)) : string.Empty;
 }
Пример #3
0
        public void Setup()
        {
            repository = MockRepository.GenerateStub<IIdeaRepository>();
            controller = new SiteIdeasController(repository);
            httpContextMock = new HttpContextMock();

            controller.ControllerContext = new ControllerContext(httpContextMock.Context, new RouteData(), controller);

            resultIdea = new Idea() { Id = 1, Title = "test" };

            httpContextMock.Request.Stub(x => x.HttpMethod).Return("GET");
            resultIdea = new Idea() { Id = 1, Title = "test" };
            ideaVM = new IdeaInList(resultIdea);
            repository.Stub(x => x.GetById(1)).Return(resultIdea);
        }
Пример #4
0
 public IdeaInList(Idea idea)
     : this(idea.Id,idea.CreationDate,idea.Title,idea.Author,idea.Comments.Count,idea.Votes.Up,idea.Votes.Down, idea.Tags.Select(x=>x.Name))
 {
 }
Пример #5
0
 public void Setup()
 {
     _suggest = new Idea();
 }
Пример #6
0
 public void Update(Idea item)
 {
     _context.Entry(item).State = EntityState.Modified;
 }
Пример #7
0
 public void Delete(Idea item)
 {
     _context.Ideas.Remove(item);
 }
Пример #8
0
 public void Add(Idea item)
 {
     _context.Ideas.Add(item);
 }
Пример #9
0
 public ActionResult Edit(Idea suggest)
 {
     if (ModelState.IsValid)
     {
         _repo.Update(suggest);
         return RedirectToAction("Index");
     }
     return View(suggest);
 }
Пример #10
0
 public void Update(Idea item)
 {
     throw new NotImplementedException();
 }