Spice icon indicating copy to clipboard operation
Spice copied to clipboard

Coupons without image uploaded

Open PRS-M opened this issue 4 years ago • 1 comments

@bhrugen In the current version if the Coupon is uploaded without an image file selected, then Details and Edit Views cannot load properly due to the Model.Picture being null.

Just a small change and the view can be rendered without any image if the Picture property is null. I can submit a Pull Request with the proposed change.

PRS-M avatar Jun 08 '20 20:06 PRS-M

@bhrugen @PRS-M
hi I had the same Problem , in the Coupon <Delete View> or other views i used this code and Problem is solved :

@{
       if (Model.Picture==null){
             <p>No picture is available</p>
          }
       else{
               var base64 = Convert.ToBase64String(Model.Picture);
               var imgsrc = string.Format("data:image/jpg;base64,{0}", base64);
               <img src="@imgsrc" height="100%" width="100%" />
              }
     }

mossykazemi avatar Jul 21 '20 17:07 mossykazemi