Пример #1
0
 public ActionResult Delete(GuestbookDto theBookToDeleteDto)
 {
     try
     {
         mGuestbookManagement.Remove(theBookToDeleteDto);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Пример #2
0
 public ActionResult Edit(GuestbookDto theBookToEditDto)
 {
     try
     {
         mGuestbookManagement.Modify(theBookToEditDto);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Пример #3
0
 public IActionResult Create(GuestbookDto newGuestbookDto)
 {
     try
     {
         // TODO: Add insert logic here
         mGuestbookManagement.Add(newGuestbookDto.Name);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
Пример #4
0
        public GuestbookDto Add(string sName)
        {
            IGuestbook newBook = Guestbook.CreateGuestbook(sName);

            newBook = mGuestbookRepository.Add(newBook); // engine code with storage

            //Mapping domain object to ui object
            GuestbookDto newBookDto = new GuestbookDto
            {
                Name = newBook.Name,
                Id   = newBook.Id
            };

            return(newBookDto);
        }
Пример #5
0
        public bool Modify(GuestbookDto theGuestbook)
        {
            IGuestbook theBookToModify = mGuestbookRepository.GetById(theGuestbook.Id);

            if (theBookToModify != null)
            {
                // Mapping all ui objects to domain objects
                theBookToModify.Name = theGuestbook.Name;
                // fill in the guestbookentry list!
                mGuestbookRepository.Update(theBookToModify);

                return(true);
            }

            return(false);
        }
Пример #6
0
        public GuestbookDto FindById(int Id)
        {
            IGuestbook theGuestbook = mGuestbookRepository.GetById(Id);

            if (theGuestbook != null)
            {
                GuestbookDto theGuestbookDto = new GuestbookDto
                {
                    Name = theGuestbook.Name,
                    Id   = theGuestbook.Id
                };

                return(theGuestbookDto);
            }

            return(null);
        }
 public void Put(int id, [FromBody] GuestbookDto theDto)
 {
     int a = 10;
 }
Пример #8
0
        // GET: Guestbook/Delete/5
        public ActionResult Delete(int id)
        {
            GuestbookDto theBookDto = mGuestbookManagement.FindById(id);

            return(View(theBookDto));
        }
Пример #9
0
 public bool Remove(GuestbookDto theGuestbook)
 {
     throw new NotImplementedException();
 }