public async Task <ActionResult> Create(DogMedicalRecord model, IEnumerable <HttpPostedFileBase> files)
        {
            if (!ModelState.IsValid)
            {
                var dog = _dogProfileRepo.GetById(model.DogProfileID);
                SetDogViewBag(dog);
                return(View(model));
            }

            _dogMedicalRecordsRepo.Insert(model);

            if (files != null)
            {
                await UploadFiles(model.RecordID, files);
            }

            return(RedirectToAction("Index", new { dogProfileId = model.DogProfileID }));
        }
        public virtual async Task <ActionResult> Edit(DogMedicalRecord model, IEnumerable <HttpPostedFileBase> files)
        {
            if (!ModelState.IsValid)
            {
                var dog = _dogProfileRepo.GetById(model.DogProfileID);

                SetDogViewBag(dog);

                ViewBag.MedicalRecordTypesSelectList = new SelectList(_medicalRecordTypesRepo.GetAll(), "MedicalRecordTypeID", "Name");

                return(View(model));
            }

            _dogMedicalRecordsRepo.Update(model);

            if (files != null)
            {
                await UploadFiles(model.RecordID, files);
            }

            return(RedirectToAction("Index", new { dog = model.DogProfileID }));
        }