I try to make patients table. I pulled the data from the database with entityframework. But I want to make the gender data male if true then female if false
aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DentistAppointmentSystem.Entity;
namespace DentistAppointmentSystem.AdminPages
{
public partial class DPatients : System.Web.UI.Page
{
DentistAppointmentSystemEntities db = new DentistAppointmentSystemEntities();
protected void Page_Load(object sender, EventArgs e)
{
var hastalar = (from x in db.TBL_PATIENTS
select new
{
x.TBL_USERS.Name,
x.TBL_USERS.Surname,
x.IDNumber,
x.Gender,
x.Birthday,
x.Phone
}).ToList();
Repeater1.DataSource = hastalar;
Repeater1.DataBind();
}
}
}
I pulled the data from the database with entityframework. But I want to make the gender data male if true then female if false
2
Answers
You can make this change within your anonymous projection.
You can also make a function :
and then call it like:
x.Gender = GetGender(x.Gender)