示例#1
0
        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));
        }
示例#2
0
        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 }));
        }
示例#3
0
        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 }));
        }
示例#4
0
        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 }));
        }
示例#5
0
 public ActionResult CreateOrUpdateDogNote(DogNote dogNote)
 {
     throw new NotImplementedException();
 }