public ActionResult Create(HeadlineViewModel model)
 {
     if (model.Title == null || model.Body == null)
     {
         Danger("Your message must have a title and body!");
         return View();
     }
     try
     {
         //create the new headine
         var headline = new Headline
         {
             Title = model.Title,
             Body = model.Body,
             SubmittedOn = DateTime.Now,
             HeadlineId = Utils.HeadlineUtils.GetNewHeadlineId(context),
             SubmitedById = User.Identity.Name,
             EditedOn = null
         };
         context.Headlines.Add(headline);
         context.SaveChanges();
         return RedirectToAction("Index");
     }
     catch (Exception)
     {
         return RedirectToAction("Oops", "Home");
     }
 }
        public ActionResult Edit(string HeadlineId, HeadlineViewModel model)
        {
            if (model.Title == null || model.Body == null)
            {
                Danger("Your message must have a title and body!");
                return View();
            }
            try
            {
                var headline = _repo.GetHeadlineById(HeadlineId);
                headline.EditedOn = DateTime.Now;
                headline.EditedById = User.Identity.Name;
                headline.Title = model.Title;
                headline.Body = model.Body;

                context.Headlines.AddOrUpdate(headline);
                context.SaveChanges();

                return RedirectToAction("Index", headline);
            }
            catch (HeadlineNotFoundException)
            {
                return RedirectToAction("Oops", "Home");
            }
        }
        public ActionResult Edit(string HeadlineId)
        {
            try
            {
                var headline = _repo.GetHeadlineById(HeadlineId);
                var edit = new HeadlineViewModel
                {
                    Title = headline.Title,
                    Body = headline.Body,
                    SubmittedOn = headline.SubmittedOn,
                    SubmitedById = headline.SubmitedById,
                    HeadlineId = headline.HeadlineId,
                    EditedById = User.Identity.Name
                };

                return View(edit);

            }

            catch (HeadlineNotFoundException)
            {
                return RedirectToAction("Oops", "Home");
            }
        }