Example #1
0
        public ActionResult Index()
        {
            var ManagementData = new ManagementDTO()
            {
                ManagementList = db.Managements.ToList()
            };

            return(View(ManagementData));
        }
Example #2
0
        public ActionResult Edit(int id)
        {
            var ManagementData = new ManagementDTO()
            {
                ManagementList = db.Managements.ToList(),
                ManagementData = db.Managements.FirstOrDefault(x => x.Id == id)
            };

            return(View("Index", ManagementData));
        }
Example #3
0
        public ActionResult Index(ManagementDTO manage)
        {
            if (manage.ManagementData.Id == 0)
            {
                db.Managements.Add(manage.ManagementData);
                db.SaveChanges();
            }
            else
            {
                var dataManage = db.Managements.FirstOrDefault(a => a.Id == manage.ManagementData.Id);
                dataManage.Email    = manage.ManagementData.Email;
                dataManage.Password = manage.ManagementData.Password;
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }