コード例 #1
0
        public ActionResult Edit(int id, Lookout lookout, int s, List <PreferredCompany> pc)
        {
            Lookout look = db.Lookouts.Find(id);

            lookout.LastActive = System.DateTime.Now;
            db.Entry(look).CurrentValues.SetValues(lookout);
            db.SaveChanges();
            //    WorkShift ws = new WorkShift();
            //      Shift sf = new Shift();
            //        sf = db.Shifts.Find(s);
            //          ws.Lookout_Id = look.Id;
            //            ws.Shift_Id = sf.id;
            WorkShift ws  = db.WorkShifts.FirstOrDefault(a => a.Lookout_Id == id);
            WorkShift wst = new WorkShift();
            Shift     sf  = new Shift();

            sf                 = db.Shifts.Find(s);
            ws.Shift_Id        = sf.id;
            db.Entry(ws).State = EntityState.Modified;
            db.SaveChanges();



            return(Json("", JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public ActionResult Edit(int id, Lookout lookout, int s, List <PreferredCompany> pc, string locids)
        {
            string[] nameslist = locids.Split(',');
            lookout.LastActive      = System.DateTime.Now;
            db.Entry(lookout).State = EntityState.Modified;
            db.SaveChanges();
            WorkShift ws = db.WorkShifts.FirstOrDefault(a => a.Lookout_Id == id);
            Shift     sf = new Shift();

            sf                 = db.Shifts.Find(s);
            ws.Shift_Id        = sf.id;
            db.Entry(ws).State = System.Data.Entity.EntityState.Modified;  //EntityState.Modified;
            db.SaveChanges();
            foreach (var list in pc)
            {
                PreferredCompany pcs = db.PreferredCompanies.FirstOrDefault(a => a.Lookout_id == list.Lookout_id);
                db.Entry(pcs).CurrentValues.SetValues(pc);
                db.SaveChanges();
            }

            PreferredLocation        pr  = new PreferredLocation();
            List <PreferredLocation> prl = db.PreferredLocations.Where(ax => ax.Lookout_id == lookout.Id).ToList();

            foreach (var a in nameslist)
            {
                int      c   = Convert.ToInt16(a);
                Location loc = db.Locations.FirstOrDefault(ax => ax.City_id == c);
                //List<PreferredLocation> prl = db.PreferredLocations.Where(ax => ax.Lookout_id==lookout.Id).ToList();
                foreach (var lis in prl)
                {
                    db.PreferredLocations.Remove(lis);
                    db.SaveChanges();
                }
                var l = Convert.ToInt16(loc.id);
                pr.Location_id = l;
                pr.Lookout_id  = lookout.Id;
                db.PreferredLocations.Add(pr);
                db.SaveChanges();

                //    var l = Convert.ToInt16(loc.id);
                //    if (prl.Lookout_id == lookout.Id)
                //    {
                //        prl.Location_id=l;
                //        db.Entry(prl).CurrentValues.SetValues(nameslist);
                //        db.SaveChanges();
                //    }
            }

            return(Json("", JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
 public ActionResult edit(int id, UserDetail ud)
 {
     ud.ModifiedOn      = System.DateTime.Now;
     ud.IsActive        = true;
     db.Entry(ud).State = EntityState.Modified;
     db.SaveChanges();
     return(Json("", JsonRequestBehavior.AllowGet));
 }
コード例 #4
0
        public ActionResult Edit(int id, Company company)
        {
            Company comp = db.Companies.Find(id);

            db.Entry(comp).CurrentValues.SetValues(company);
            db.SaveChanges();
            return(Json("", JsonRequestBehavior.AllowGet));
        }
コード例 #5
0
        public ActionResult edit(int id, UserEducation ue)
        {
            UserEducation ues = db.UserEducations.Find(id);

            ues.ModifiedOn = System.DateTime.Now;
            db.Entry(ues).CurrentValues.SetValues(ue);
            db.SaveChanges();
            return(Json("", JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
 public ActionResult Edit(primecollege primecollege)
 {
     if (ModelState.IsValid)
     {
         db.Entry(primecollege).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(primecollege));
 }
コード例 #7
0
 public ActionResult Edit([Bind(Include = "Id,FullName")] Employer employer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employer));
 }
コード例 #8
0
 public ActionResult Edit(Country country)
 {
     if (ModelState.IsValid)
     {
         db.Entry(country).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(country));
 }
コード例 #9
0
 public ActionResult Edit([Bind(Include = "Id,Tag")] JobTag jobTag)
 {
     if (ModelState.IsValid)
     {
         db.Entry(jobTag).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(jobTag));
 }
コード例 #10
0
 public ActionResult Edit([Bind(Include = "Id,IndustryType1,Isactive,CreatedOn,ModifiedOn")] IndustryType IndustryType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(IndustryType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(IndustryType));
 }
コード例 #11
0
 public ActionResult Edit(Company company)
 {
     if (ModelState.IsValid)
     {
         db.Entry(company).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     //ViewBag.IndustryTypeId = new SelectList(db.IndustryTypes, "Id", "IndustryType1", company.IndustryTypeId);
     return(View(company));
 }
コード例 #12
0
 public ActionResult Edit(State state)
 {
     if (ModelState.IsValid)
     {
         db.Entry(state).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Country_id = new SelectList(db.Countries, "id", "CountryName", state.CountryId);
     return(View(state));
 }
コード例 #13
0
 public ActionResult Edit([Bind(Include = "Id_Pozicion,Emri_Poz,Tipi,ID_Kompanie")] PozicionPune pozicionPune)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pozicionPune).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ID_Kompanie = new SelectList(db.Kompanias, "ID_Kompani", "Emri", pozicionPune.ID_Kompanie);
     return(View(pozicionPune));
 }
コード例 #14
0
 public ActionResult Edit([Bind(Include = "Id_Aplikim,Pozc_Id,Komp_Id,Orari")] Aplikim aplikim)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aplikim).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Komp_Id = new SelectList(db.Kompanias, "ID_Kompani", "Emri", aplikim.Komp_Id);
     ViewBag.Pozc_Id = new SelectList(db.PozicionPunes, "Id_Pozicion", "Emri_Poz", aplikim.Pozc_Id);
     return(View(aplikim));
 }
コード例 #15
0
 public ActionResult Edit(IndustryType businessStream)
 {
     businessStream.Isactive   = true;
     businessStream.ModifiedOn = System.DateTime.Now;
     if (ModelState.IsValid)
     {
         db.Entry(businessStream).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(businessStream));
 }
コード例 #16
0
 public ActionResult Edit(PlanMaster planMaster)
 {
     if (ModelState.IsValid)
     {
         planMaster.Isactive        = true;
         planMaster.ModifiedOn      = DateTime.Now;
         db.Entry(planMaster).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(planMaster));
 }
コード例 #17
0
 public ActionResult Edit([Bind(Include = "id,CityName,State_id,IsActive,CreatedOn")] City city)
 {
     city.Isactive = true;
     if (ModelState.IsValid)
     {
         db.Entry(city).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.State_id = new SelectList(db.States, "id", "StateName", city.StateId);
     return(View(city));
 }
コード例 #18
0
 public ActionResult Edit(PersonalInfo personalInfo)
 {
     if (ModelState.IsValid)
     {
         db.Entry(personalInfo).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Skill_Id = new SelectList(db.Skills, "id", "SkillName", personalInfo.Skill_Id);
     ViewBag.User_Id  = new SelectList(db.UserDetails, "ID", "UserName", personalInfo.User_Id);
     return(View(personalInfo));
 }
コード例 #19
0
 public ActionResult Edit(Recruiter recruiter)
 {
     if (ModelState.IsValid)
     {
         db.Entry(recruiter).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     //ViewBag.ComId = new SelectList(db.Companies, "Id", "CompanyName", recruiter.ComId);
     ViewBag.Id = new SelectList(db.Recruiters, "Id", "Name", recruiter.Id);
     ViewBag.Id = new SelectList(db.Recruiters, "Id", "Name", recruiter.Id);
     return(View(recruiter));
 }
コード例 #20
0
 public ActionResult Edit(Certification certification)
 {
     certification.IsActive   = true;
     certification.ModifiedOn = System.DateTime.Now;
     if (ModelState.IsValid)
     {
         db.Entry(certification).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PersonalInfo_id = new SelectList(db.PersonalInfoes, "id", "id", certification.PersonalInfo_id);
     return(View(certification));
 }
コード例 #21
0
 public ActionResult Edit(UserExperience userExperience)
 {
     userExperience.ModifiedOn = System.DateTime.Now;
     userExperience.IsActive   = true;
     if (ModelState.IsValid)
     {
         db.Entry(userExperience).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Company_id = new SelectList(db.Companies, "id", "Companyname", userExperience.Company_id);
     ViewBag.UserId     = new SelectList(db.UserDetails, "ID", "UserName", userExperience.UserId);
     return(View(userExperience));
 }
コード例 #22
0
 public ActionResult Edit(Location location)
 {
     location.IsActive   = true;
     location.ModifiedOn = DateTime.Now;
     if (ModelState.IsValid)
     {
         db.Entry(location).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.City_id    = new SelectList(db.Cities, "id", "CityName", location.City_id);
     ViewBag.Country_id = new SelectList(db.Countries, "id", "CountryName", location.Country_id);
     ViewBag.State_id   = new SelectList(db.States, "id", "StateName", location.State_id);
     return(View(location));
 }
コード例 #23
0
        [ValidateAntiForgeryToken]        //[Bind(Include = "Title,Id,EmployerID,SelectedJobTags")]
        public ActionResult Edit(JobPostViewModel jobpostView)
        {
            if (jobpostView == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }



            if (ModelState.IsValid)
            {
                var jobToUpdate = _db.JobPosts
                                  .Include(i => i.JobTags).First(i => i.Id == jobpostView.JobPost.Id);

                if (TryUpdateModel(jobToUpdate, "JobPost", new string[] { "Title", "EmployerID" }))
                {
                    var newJobTags = _db.JobTags.Where(
                        m => jobpostView.SelectedJobTags.Contains(m.Id)).ToList();
                    var updatedJobTags = new HashSet <int>(jobpostView.SelectedJobTags);
                    foreach (JobTag jobTag in _db.JobTags)
                    {
                        if (!updatedJobTags.Contains(jobTag.Id))
                        {
                            jobToUpdate.JobTags.Remove(jobTag);
                        }
                        else
                        {
                            jobToUpdate.JobTags.Add((jobTag));
                        }
                    }

                    _db.Entry(jobToUpdate).State = System.Data.Entity.EntityState.Modified;
                    _db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            ViewBag.EmployerID = new SelectList(_db.Employers, "Id", "FullName", jobpostView.JobPost.EmployerID);
            return(View(jobpostView));
        }