//gets dal and convert it to dto (by the ctor) public Meets1(Dal.Meets m) : this() { MeetId = m.MeetId; PatientId = (int)m.PatientId; TherapistId = (int)m.TherapistId; MeetDate = m.MeetDate; CategoryId = (int)m.CategoryId; Dal.Therapists t = Dal.TherapistsDal.GetById(TherapistId); TherapistName = t.FirstName + " " + t.LastName; CategoryName = Dal.CategoriesDal.GetById(CategoryId).CategoryName; Dal.Patients p = Dal.PatientsDal.GetById(PatientId); PatientName = p.Firstname + " " + p.Lastname; }
public static bool Register(Meets m) { try { using (Natural_wayEntities db = new Natural_wayEntities()) { db.Meets.Add(m); db.SaveChanges(); } } catch (Exception e) { return(false); } return(true); }