Пример #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));
        }
        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;
            }
        }