Link to home
Start Free TrialLog in
Avatar of RBS
RBS

asked on

Linq transform field

Hi:

I have a field in a products table that I am trying to transform when it is in a list from "MyPic" to "/Content/Image/MyPic_small.png"

The Model is:
public class Product
    {
        public int ProductId { get; set; }
        public int GenreId { get; set; }
        public string Title { get; set; }
       public string PicUrl { get; set; }
        public virtual Genre Genre { get; set; }
    }

Open in new window


The current Linq expression is:
var genreModel = storeDB.Genres.Include("Products")
.Single(g => g.Name == genre);

Open in new window


My Pic is found in the field PicUrl.  Any help in figuring out how to do this in the Linq expression greatly appreciated.

RBS
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RBS
RBS

ASKER

Fernando:

Thanks for your response - I'm afraid I found a quick solution and then went off and did other things - and well, dropped the ball.  I think looking back on it now that I probably need to create a dto but for now don't have time and my quick solution is working.

Regards,
RBS
Not a problem, glad to help.