Esempio n. 1
0
        public ActionResult EditEmployee(int id, Employee model)
        {
            var employee = db.Employees.Single(c => c.empId == id);

            employee.State       = model.State;
            employee.City        = model.City;
            employee.DateofBirth = (model.DateofBirth);
            employee.Province    = model.Province;
            employee.Cnic        = model.Cnic;

            db.SaveChanges();
            return(RedirectToAction("index"));
        }
Esempio n. 2
0
        public ActionResult Create(companyViewModel model)
        {
            try
            {
                DB51Entities db = new DB51Entities();
                Company      c  = new Company();
                c.Code       = Convert.ToInt16(model.Cid);
                c.Name       = model.coName;
                c.Fax        = model.fax;
                c.Email      = model.email;
                c.PhoneNo    = model.phoneNumber;
                c.PostalCode = model.postalCode;
                c.Url        = model.url;
                db.Companies.Add(c);
                db.SaveChanges();


                return(View());

                // return RedirectToAction("Index");
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(DepartmentViewModel model)
        {
            try
            {
                // TODO: Add insert logic here
                Department   d  = new Department();
                DB51Entities db = new DB51Entities();
                d.Name = model.DName;
                db.Departments.Add(d);
                db.SaveChanges();

                return(View());

                //return RedirectToAction("Index");
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult Create(rankViewModel model)
        {
            try
            {
                // TODO: Add insert logic here
                DB51Entities db = new DB51Entities();
                Rank         r  = new Rank();
                r.Name = model.RName;
                db.Ranks.Add(r);
                db.SaveChanges();


                return(View());

                // return RedirectToAction("Index");
            }
            catch
            {
                return(View());
            }
        }
 // Doing Nothing
 public ActionResult CreateCompany(Company model)
 {
     db.Companies.Add(model);
     db.SaveChanges();
     return(RedirectToAction("CompaniesList"));
 }