public virtual ActionResult Create(DogProfile dog) { var model = new DogNote { DogProfileID = dog.ProfileID }; SetDogViewBag(dog); ViewBag.NoteTypeSelectList = new SelectList(_noteTypeRepo.GetAll(), "ID", "Name", model.NoteTypeId); return(View(model)); }
public async Task <ActionResult> Edit(DogNote model, IEnumerable <HttpPostedFileBase> files) { if (!ModelState.IsValid) { return(View(model)); } _dogNoteRepo.Update(model); await UploadFiles(model.NoteID, files); return(RedirectToAction("Index", new { dogProfileId = model.DogProfileID })); }
public virtual async Task <ActionResult> Edit(DogNote model, IEnumerable <HttpPostedFileBase> files) { if (!ModelState.IsValid) { var dog = _dogProfileRepo.GetById(model.DogProfileID); SetDogViewBag(dog); ViewBag.NoteTypeSelectList = new SelectList(_noteTypeRepo.GetAll(), "ID", "Name", model.NoteTypeId); return(View(model)); } _dogNoteRepo.Update(model); await DoFileUpload(model.NoteID, files); return(RedirectToAction("Index", new { dog = model.DogProfileID })); }
public ActionResult CreateOrUpdateDogNote(DogNote dogNote) { var user = _userRepo.Where(u => u.Email == this.HttpContext.User.Identity.Name).FirstOrDefault(); if (dogNote.NoteID == 0) { dogNote.CreatedDate = DateTime.UtcNow; dogNote.CreatedByUserId = user.UserID; _dogNoteRepo.Insert(dogNote); } else { // No update columns on note. How to specify what user edited a note and when? Overwriting for now with last edit wins. dogNote.CreatedByUserId = user.UserID; dogNote.CreatedDate = DateTime.UtcNow; _dogNoteRepo.Update(dogNote); } return(RedirectToAction("ReadDog", new { id = dogNote.DogProfileID })); }
public ActionResult CreateOrUpdateDogNote(DogNote dogNote) { throw new NotImplementedException(); }