Example #1
0
        public bool AddOrUpdateModerator(vidlyDbContext.Entities.Moderator moderator)
        {
            var flag = false;

            try
            {
                moderator.UserType = "moderator";
                context.Moderators.AddOrUpdate(m => m.Id, moderator);
                context.SaveChanges();
                flag = true;
            }
            catch (Exception exception)
            {
                flag = false;
            }
            return(flag);
        }
Example #2
0
 public ActionResult EditProfile(vidlyDbContext.Entities.Moderator moderator)
 {
     if (GetSessionId() != 0)
     {
         if (AddOrUpdateModerator(moderator))
         {
             return(RedirectToAction("ModeratorProfile"));
         }
         else
         {
             return(RedirectToAction("EditProfile"));
         }
     }
     else
     {
         return(RedirectToAction(logInUrl));
     }
 }