public async Task <IActionResult> Edit(string id, [Bind("Id,Name,ApplicationUserId,RegionId")] Appellation appellation)
        {
            if (id != appellation.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appellation);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppellationExists(appellation.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            var userId = User.FindFirstValue(ClaimTypes.NameIdentifier);

            ViewBag.Regions = new SelectList(_context.Region
                                             .Where(r => r.ApplicationUserId == userId), "Id", "Name", appellation.RegionId);
            return(View(appellation));
        }
Esempio n. 2
0
 private void BindCall()
 {
     BLL.cCall blllcc = new BLL.cCall();
     Appellation.DataSource     = blllcc.GetAllList();
     Appellation.DataTextField  = "callName";
     Appellation.DataValueField = "ID";
     Appellation.DataBind();
 }
        // GET: Appellations/Create
        public IActionResult Create()
        {
            var userId      = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var appellation = new Appellation()
            {
                ApplicationUserId = userId
            };

            ViewBag.Regions = new SelectList(_context.Region
                                             .Where(r => r.ApplicationUserId == userId), "Id", "Name");
            return(View(appellation));
        }
        public async Task <IActionResult> Create([Bind("Id,Name,RegionId,ApplicationUserId")] Appellation appellation)
        {
            if (ModelState.IsValid)
            {
                _context.Add(appellation);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.Regions = new SelectList(_context.Region
                                             .Where(r => r.ApplicationUserId == appellation.ApplicationUserId), "Id", "Name", appellation.RegionId);
            return(View(appellation));
        }
Esempio n. 5
0
 public void AddToAppellations(Appellation appellation)
 {
     base.AddObject("Appellations", appellation);
 }
Esempio n. 6
0
 public static Appellation CreateAppellation(string ID)
 {
     Appellation appellation = new Appellation();
     appellation.Id = ID;
     return appellation;
 }