public async Task <ActionResult> CreateAsync([Bind(Include = "Id,Name,Surname,Email,TelephoneNumber,CellphoneNumber,isActive,StudentNumber")] VM vm, AppDevBusiness appbusiness, PhotoUpload photo, HttpPostedFileBase file) { if (ModelState.IsValid) { Student s = new Student(); s.Name = vm.Name; s.Surname = vm.Surname; s.TelephoneNumber = vm.TelephoneNumber; s.isActive = vm.isActive; s.Id = vm.Id; s.Email = vm.Email; s.CellphoneNumber = vm.CellphoneNumber; photo.StudentNumber = vm.StudentNumber; String studentnumber = vm.Id; await DocumentDBRepository <Student> .CreateItemAsync(s); if (photo.FileUpload != null && photo.FileUpload.ContentLength > 0) { appbusiness.UploadPhoto("images", photo.FileUpload, studentnumber); } } return(RedirectToAction("Index")); }
public ActionResult Upload(PhotoUpload photo, AppDevBusiness appbusiness, string studentnumber) { if (photo.FileUpload != null && photo.FileUpload.ContentLength > 0) { appbusiness.UploadPhoto("images", photo.FileUpload, studentnumber); } return(RedirectToAction("Index")); }