Esempio n. 1
0
        public static bool IsAllowedToCreateCfp(this IPrincipal user, Conference conference)
        {
            if (conference.IsCfpOpen())
                return true;

            // TODO Only allow for certain conferences.
            if (user != null && user.IsInRole("VipSpeaker"))
            {
                return true;
            }
            return false;
        }
        public async Task<ActionResult> Edit(int id, Conference conference)
        {
            if (ModelState.IsValid)
            {
                try
                {
					_dbContext.Entry(conference).State = EntityState.Modified;
					await _dbContext.SaveChangesAsync();

                    return RedirectToAction("Conference", "ConferenceAdmin", new { id });
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("Updating", ex);
                }
            }
            return View(conference);
        }
 public async Task<ActionResult> Edit(Conference conference)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _dbContext.Conferences.Add(conference);
             await _dbContext.SaveChangesAsync();
             return RedirectToAction("Conference", "ConferenceAdmin", new { conference.Id });
         }
         catch (Exception ex)
         {
             ModelState.AddModelError("Updating", ex);
         }
     }
     return View(conference);
 }