public ActionResult Delete(GuestbookDto theBookToDeleteDto) { try { mGuestbookManagement.Remove(theBookToDeleteDto); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Edit(GuestbookDto theBookToEditDto) { try { mGuestbookManagement.Modify(theBookToEditDto); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public IActionResult Create(GuestbookDto newGuestbookDto) { try { // TODO: Add insert logic here mGuestbookManagement.Add(newGuestbookDto.Name); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
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); }
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); }
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; }
// GET: Guestbook/Delete/5 public ActionResult Delete(int id) { GuestbookDto theBookDto = mGuestbookManagement.FindById(id); return(View(theBookDto)); }
public bool Remove(GuestbookDto theGuestbook) { throw new NotImplementedException(); }