Ejemplo n.º 1
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());
            }
        }
 public AccountController()
 {
     db = new DB51Entities();
 }