private void UpdateLocation(CommitteeEvent evt, string currentUser)
        {
            if (evt.Location == null)
            {
                return;
            }

            var location = evt.Location;

            if (string.IsNullOrEmpty(location.Name) &&
                location.Address != null &&
                string.IsNullOrEmpty(location.Address.StreetAddress))
            {
                evt.Location = null;
                return;
            }

            if (location.LocationId == default(int))
            {
                context.Entry(location).State = System.Data.Entity.EntityState.Added;
            }
            else
            {
                context.Entry(location).State = System.Data.Entity.EntityState.Modified;
            }
        }
        private ActionResult CreateOrEdit(CommitteePost post, CommitteeEvent evt, HttpPostedFileBase File)
        {
            if (File != null)
            {
                var postFile = new PostFile();
                postFile.PostId     = post.PostId;
                postFile.PostedFile = File;
                serverFileRepository.InsertOrUpdate(postFile, CurrentUser);
                serverFileRepository.Save();

                return(Edit(post.PostId));
            }

            // Couldn't get the Location.LocationId key to work correctly with the hidden
            // field so just remove it from validation.
            ModelState.Remove("Location.LocationId");
            if (ModelState.IsValid)
            {
                if (evt.Location == null)
                {
                    return(Save(post));
                }
                else
                {
                    if (evt.ViewEndDate > evt.EventDate)
                    {
                        evt.EndDate = evt.ViewEndDate;
                    }

                    return(Save(evt));
                }
            }
            else
            {
                if (evt.Location == null)
                {
                    return(View(post));
                }
                else
                {
                    return(View(evt));
                }
            }
        }
 public ActionResult Create(CommitteePost post, CommitteeEvent evt, HttpPostedFileBase File)
 {
     return(CreateOrEdit(post, evt, File));
 }