예제 #1
0
        //[ValidateAntiForgeryToken]
        public async Task <IActionResult> CreatePhone(string key)
        {
            if (key == null)
            {
                return(NotFound());
            }
            CenterPhoneNumber cpn = new CenterPhoneNumber()
            {
                Phone = key
            };

            _db.CenterPhoneNumbers.Add(cpn);
            await _db.SaveChangesAsync();

            return(PartialView("_PhonePartial", cpn));
        }
예제 #2
0
        public async Task <IActionResult> DeletePhone(string key, int?id)
        {
            //int idx = Int32.Parse(key);
            CenterPhoneNumber cpn = await _db.CenterPhoneNumbers.FindAsync(id);

            if (cpn == null)
            {
                return(NotFound());
            }

            if (cpn.DataId != null)
            {
                cpn.DataId = null;
            }

            _db.CenterPhoneNumbers.Remove(cpn);
            await _db.SaveChangesAsync();

            return(RedirectToAction(nameof(Phone)));
        }