public ActionResult DeletePhotoDetails(string ProductPhotoMappingId)
        {
            StringBuilder ErrorMessages   = new StringBuilder();
            StringBuilder SuccessMessages = new StringBuilder();

            if (isAdminUser())
            {
                try
                {
                    PricingPhotoData pricingPhotoData = new PricingPhotoData();
                    pricingPhotoData.ProductPhotoMappingId = ProductPhotoMappingId;
                    bool DeleteResult = false;
                    DeleteResult = PricingDetailsProxy.CUDPricingPhotoDetails(pricingPhotoData, "Delete");
                    DataSet   PricingDataSet   = new DataSet();
                    DataTable PricingDataTable = new DataTable();
                    PricingDataSet   = PricingDetailsProxy.FetchPricingDetails();
                    PricingDataTable = PricingDataSet.Tables[0];
                    PricingDataTable = DataTablePhotoMapping(PricingDataTable);
                    managePricing_IndexViewModel.PricingDataTable = PricingDataTable;
                    if (DeleteResult == false)
                    {
                        ErrorMessages.Append(CUDConstants.DeleteError);
                    }
                    else
                    {
                        SuccessMessages.Append(CUDConstants.DeleteSuccess);
                    }
                }
                catch (Exception e)
                {
                    ErrorMessages.Append(CUDConstants.DeleteError);
                }
                if (!String.IsNullOrEmpty(SuccessMessages.ToString()))
                {
                    managePricing_IndexViewModel.SuccessMessage = SuccessMessages.ToString();
                }
                if (!String.IsNullOrEmpty(ErrorMessages.ToString()))
                {
                    managePricing_IndexViewModel.ErrorMessage = ErrorMessages.ToString();
                }

                return(PartialView("PricingDataTable", managePricing_IndexViewModel));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }

            return(View());
        }
        public ActionResult CUProductImage(HttpPostedFileBase ImageFile, string ProductId, string ProductPricingId, string Ordinal, string ProductPhotoMappingId)
        {
            string filename  = ImageFile.FileName;
            string ImagePath = Server.MapPath("~/ProductImages/");

            ImagePath = ImagePath + filename;
            try
            {
                if (isAdminUser())
                {
                    PricingPhotoData pricingPhotoData = new PricingPhotoData();
                    ImageFile.SaveAs(ImagePath);
                    string Base64 = ProcessFile(ImagePath);
                    int    OrdinalInt;
                    int.TryParse(Ordinal, out OrdinalInt);
                    pricingPhotoData.Ordinal          = OrdinalInt;
                    pricingPhotoData.Photo            = Base64;
                    pricingPhotoData.ProductId        = ProductId;
                    pricingPhotoData.ProductPricingId = ProductPricingId;
                    if (String.IsNullOrEmpty(ProductPhotoMappingId))
                    {
                        pricingPhotoData.ProductPhotoMappingId = Guid.NewGuid().ToString();
                        PricingDetailsProxy.CUDPricingPhotoDetails(pricingPhotoData, "Insert");
                    }
                    else
                    {
                        pricingPhotoData.ProductPhotoMappingId = ProductPhotoMappingId;
                        PricingDetailsProxy.CUDPricingPhotoDetails(pricingPhotoData, "Update");
                    }
                    System.IO.File.Delete(ImagePath);
                    managePricing_IndexViewModel.SuccessMessage = UploadConstants.UploadSuccessMessage;
                    return(RedirectToAction("Index", "ManagePricing", managePricing_IndexViewModel));
                }
                else
                {
                    return(RedirectToAction("Index", "Home"));
                }
            }
            catch (Exception e)
            {
                managePricing_IndexViewModel.ErrorMessage = CUDConstants.InsertError;
                System.IO.File.Delete(ImagePath);
                return(RedirectToAction("Index", "ManagePricing", managePricing_IndexViewModel));
            }
            return(View());
        }