public DreamJob GetDreamJobByID(int? id)
        {
            DreamJob dreamj = new DreamJob();

            if (id == null)
            {
                return null;
            }
            var peo = db.DreamJobs
                    .Where(b => b.UserInfoID == id)
                    .FirstOrDefault();


            if (peo == null)
            {
                return null;
            }
            else {
                dreamj.ID = peo.ID;
                dreamj.companyName = peo.companyName;
                dreamj.position = peo.position;
                dreamj.startDate = peo.startDate;
                dreamj.description = peo.description;
                dreamj.UserInfoID = peo.UserInfoID;

            }

            //if (dreamj == null)
            //{
            //    return null;
            //}
            return dreamj;
        }
        public void DeleteDreamJobByID(int?id)
        {
            DreamJob dj = db.DreamJobs.Find(id);

            db.DreamJobs.Remove(dj);
            db.SaveChanges();
        }
        public DreamJob GetDreamJobByID(int?id)
        {
            DreamJob dreamj = new DreamJob();

            if (id == null)
            {
                return(null);
            }
            var peo = db.DreamJobs
                      .Where(b => b.UserInfoID == id)
                      .FirstOrDefault();


            if (peo == null)
            {
                return(null);
            }
            else
            {
                dreamj.ID          = peo.ID;
                dreamj.companyName = peo.companyName;
                dreamj.position    = peo.position;
                dreamj.startDate   = peo.startDate;
                dreamj.description = peo.description;
                dreamj.UserInfoID  = peo.UserInfoID;
            }

            //if (dreamj == null)
            //{
            //    return null;
            //}
            return(dreamj);
        }
 public void UpdateDreamJob(DreamJob DreamJobClient)
 {
     DreamJobBusinessLayer drjobdb = new DreamJobBusinessLayer();
     drjobdb.UpdateDreamJobById(DreamJobClient);
 }
        public void AddDreamJobDetails(DreamJob DreamJobClient)
        {
            var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
            var currentUser = manager.FindById(User.Identity.GetUserId());
            int id = currentUser.UserInfo.Id;
            DreamJob dj = new DreamJob();
            dj.UserInfoID = id;
            dj.companyName = DreamJobClient.companyName;
            dj.position = DreamJobClient.position;
            dj.startDate = DreamJobClient.startDate;
            dj.description = DreamJobClient.description;

            DreamJobBusinessLayer djBal = new DreamJobBusinessLayer();
            djBal.InsertDreamJobDetails(dj);
        }
 public void UpdateDreamJobById([Bind(Include = "ID,companyName,position,startDate,description,UserInfoID")] DreamJob dreamJob)
 {
     db.Entry(dreamJob).State = EntityState.Modified;
     db.Entry(dreamJob).Property("UserInfoID").IsModified = false;
     db.SaveChanges();
 }
 public void InsertDreamJobDetails([Bind(Include = "ID,companyName,position,startDate,description,UserInfoID")] DreamJob dreamJob)
 {
     db.DreamJobs.Add(dreamJob);
     db.SaveChanges();
 }