コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            EMPLOYER eMPLOYER = db.EMPLOYERs.Find(id);

            db.EMPLOYERs.Remove(eMPLOYER);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "id,fullname,address,phoneNumber")] EMPLOYER eMPLOYER)
 {
     if (ModelState.IsValid)
     {
         db.Entry(eMPLOYER).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(eMPLOYER));
 }
コード例 #3
0
        public ActionResult Create([Bind(Include = "id,fullname,address,phoneNumber")] EMPLOYER eMPLOYER)
        {
            if (ModelState.IsValid)
            {
                db.EMPLOYERs.Add(eMPLOYER);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(eMPLOYER));
        }
コード例 #4
0
        // GET: Admin/EMPLOYER/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EMPLOYER eMPLOYER = db.EMPLOYERs.Find(id);

            if (eMPLOYER == null)
            {
                return(HttpNotFound());
            }
            return(View(eMPLOYER));
        }
コード例 #5
0
        private void ModifyEmployer(Employer employer)
        {
            try
            {
                EMPLOYER entity = _da.GetSingleBy <EMPLOYER>(p => p.Person_Id == employer.Person.Id);
                if (entity != null)
                {
                    entity.Employer_Name = employer.Name;
                    entity.Website       = employer.Website;

                    if (employer.Sex != null && employer.Sex.Id > 0)
                    {
                        entity.Sex_Id = employer.Sex.Id;
                    }

                    _da.Save();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }