Exemplo n.º 1
0
        public ActionResult Create(PhoneNumberPrefixEdit phoneNumberPrefixEdit)
        {
            if (ModelState.IsValid)
            {
                PhoneNumberPrefix phoneNumberPrefix = phoneNumberPrefixEdit.GetModel();
                Db.PhoneNumberPrefixes.Add(phoneNumberPrefix);
                Db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(phoneNumberPrefixEdit);
        }
Exemplo n.º 2
0
        public ActionResult Edit(PhoneNumberPrefixEdit phoneNumberPrefixEdit)
        {
            if (ModelState.IsValid)
            {
                PhoneNumberPrefix phoneNumberPrefix = phoneNumberPrefixEdit.GetModel();
                Db.Entry(phoneNumberPrefix).State = EntityState.Modified;
                Db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(phoneNumberPrefixEdit);
        }
Exemplo n.º 3
0
        public static PhoneNumberPrefixEdit GetModelView(PhoneNumberPrefix phoneNumberPrefix)
        {
            if (phoneNumberPrefix == null)
                return null;

            var phoneNumberPrefixEdit = new PhoneNumberPrefixEdit(phoneNumberPrefix);
            return phoneNumberPrefixEdit;
        }