Example #1
0
 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"));
 }
Example #2
0
 public ActionResult Delete(string id, AppDevBusiness appdevbusiness)
 {
     if (ModelState.IsValid)
     {
         appdevbusiness.DeletePhoto("images", id);
     }
     return(RedirectToAction("Index"));
 }
Example #3
0
        public async System.Threading.Tasks.Task <ActionResult> Details(string containername, string id)
        {
            CloudBlobContainer container   = GetBlobContainer("images");
            CloudBlockBlob     blockblob   = container.GetBlockBlobReference(id);
            ViewModelBlobs     vm          = new ViewModelBlobs();
            AppDevBusiness     appbusiness = new AppDevBusiness();

            vm.Name    = blockblob.Name;
            vm.details = blockblob.Uri.ToString();
            Uri a = blockblob.Uri;

            vm.details = await appbusiness.detailsPic(a);

            return(View(vm));
        }
Example #4
0
        public async Task <ActionResult> DeleteAsync(string id, AppDevBusiness appDevBusiness, string uriLink)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Student student = await DocumentDBRepository <Student> .GetItemAsync(id);

            string link = "https://appdevproject3.blob.core.windows.net/images" + id;

            if (link == uriLink)
            {
                appDevBusiness.DeletePhoto("images", id);
            }

            if (student == null)
            {
                return(HttpNotFound());
            }
            return(View(student));
        }
Example #5
0
 // GET: Blob
 public ActionResult Index(AppDevBusiness business)
 {
     return(View(business.GetPhotos("images")));
 }
Example #6
0
        // GET: Blobs



        // GET: Blob

        public async System.Threading.Tasks.Task <ActionResult> Index(AppDevBusiness business)
        {
            return(View(await business.GetPhotos("images")));
        }
Example #7
0
        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"));
        }