public async Task <ActionResult> Create( ProfileEntity obj, HttpPostedFileBase profileFile ) { CloudBlockBlob profileBlob = null; #region Upload File In Blob Storage //Step 1: Uploaded File in BLob Storage if (profileFile != null && profileFile.ContentLength != 0) { profileBlob = await blobOperations.UploadBlob(profileFile); obj.ProfilePath = profileBlob.Uri.ToString(); } //Ends Here #endregion #region Save Information in Table Storage //Step 2: Save the Infromation in the Table Storage //Get the Original File Size obj.Email = User.Identity.Name; // The Login Email obj.RowKey = obj.ProfileId.ToString(); obj.PartitionKey = obj.Email; //Save the File in the Table tableOperations.CreateEntity(obj); //Ends Here #endregion return(RedirectToAction("Index")); }
//public async Task<ActionResult> Create(ImageEntity obj, IFormFile profileFile) public async Task <ActionResult> Create(ImageEntity obj) { CloudBlockBlob profileBlob = null; #region Upload File In Blob Storage //Step 1: Uploaded File in BLob Storage if (obj.ImageFile != null && obj.ImageFile.Length != 0) { profileBlob = await blobOperations.UploadBlob(obj.ImageFile); obj.ImageURL = profileBlob.Uri.ToString(); } #endregion #region Save Information in Table Storage //Step 2: Save the Infromation in the Table Storage //Get the Original File Size //obj. = User.Identity.Name; // The Login Email obj.RowKey = obj.ImageName; obj.PartitionKey = Guid.NewGuid().ToString(); //Save the File in the Table tableOperations.CreateEntity(obj); //Ends Here #endregion return(RedirectToAction("Index")); }
public async Task <ActionResult> Create(OrderEntity obj, HttpPostedFileBase orderFile) { //Check if it exist: OrderEntity _order = new OrderEntity(); _order = tableOperations.GetEntity(obj.OrderId, string.Empty); if (_order != null) { _order.ETag = "*"; _order.PartitionKey = "*****@*****.**"; _order.RowKey = obj.OrderId.ToString(); _order.OrderName = obj.OrderName; _order.Quantity = obj.Quantity; _order.Description = obj.Description; tableOperations.UpdateEntity(_order); return(RedirectToAction("Index")); } CloudBlockBlob orderBlob = null; //Step 1: Uploaded File in Blob Storage if (orderFile != null && orderFile.ContentLength != 0) { orderBlob = await blobOperations.UploadBlob(orderFile); obj.OrderPath = orderBlob.Uri.ToString(); } //Step 2: Save the information in the Table Storage //Get the original file size //obj.Email = User.Identity.Name; //Login email obj.Email = "*****@*****.**"; obj.RowKey = obj.OrderId.ToString(); //obj.PartitionKey = obj.Email; obj.PartitionKey = "*****@*****.**"; //Save the file in the Table tableOperations.CreateEntity(obj); return(RedirectToAction("Index")); }