public ActionResult Createnewcar(FormCollection collection, ProductsHondaofConyers2 p, HttpPostedFileBase[] MultipleFiles,TagTable tb)
{
try
{
// TODO: Add insert logic here
var Tagid = collection["TagNo"];
var qry = (from c in db.ProductsHondaofConyers2s where c.TagNo ==Tagid select c).Count();
if (qry != 1)
{
foreach (var fileBase in MultipleFiles)
{
if (fileBase.ContentLength > 0)
{
Microsoft.WindowsAzure.StorageClient.CloudBlobContainer blobContainer = _myBlobStorageService.GetCloudBlobContainer();
CloudBlob blob = blobContainer.GetBlobReference(fileBase.FileName);
blob.UploadFromStream(fileBase.InputStream);
}
}
List<string> blobs = new List<string>();
foreach (var fileBase in MultipleFiles)
{
Microsoft.WindowsAzure.StorageClient.CloudBlobContainer blobContainer1 = _myBlobStorageService.GetCloudBlobContainer();
CloudBlob blob1 = blobContainer1.GetBlobReference(fileBase.FileName);
blobs.Add(blob1.Uri.ToString());
}
p.ProductImage = blobs.ElementAt(0).ToString();
p.ProductImage1 = blobs.ElementAt(1).ToString();
}
else
{
return RedirectToAction("EventCreationError");
}
}
catch
{
//return View();
return RedirectToAction("Createnewcar");
}
}
This is my code
It's working perfectly
I want to add one more condition in this code what is that one is
Inserted first time images inseted successfully,
At the time of 2nd time ,Suppose can i try to insert same name image display errormessage
How can i do this one plz help me