Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        public void DeleteDreamJobByID(int?id)
        {
            DreamJob dj = db.DreamJobs.Find(id);

            db.DreamJobs.Remove(dj);
            db.SaveChanges();
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 public void UpdateDreamJob(DreamJob DreamJobClient)
 {
     DreamJobBusinessLayer drjobdb = new DreamJobBusinessLayer();
     drjobdb.UpdateDreamJobById(DreamJobClient);
 }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 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();
 }
Exemplo n.º 7
0
 public void InsertDreamJobDetails([Bind(Include = "ID,companyName,position,startDate,description,UserInfoID")] DreamJob dreamJob)
 {
     db.DreamJobs.Add(dreamJob);
     db.SaveChanges();
 }