public async Task <IActionResult> Edit(string id, [Bind("Id,CN,EmailAddress")] User user)
        {
            if (id != user.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UserExists(user.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Title,EventColor")] Room room)
        {
            if (id != room.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(room);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RoomExists(room.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(room));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,MeetingDate,Conductor,OpeningHymnNumber,SacramentHymnNumber,RestHymnNumber,ClosingHymn,OpeningPrayer,ClosingPrayer,SpeakerOne,SpeakerTwo,SpeakerThree")] Meeting meeting)
        {
            if (id != meeting.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meeting);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingExists(meeting.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,FirstName,LastName,Age,Gender,Calling")] Members members)
        {
            if (id != members.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(members);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MembersExists(members.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(members));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("SpeakingAssignmentID,MeetingID,SpeakerID,Topic")] SpeakingAssignment speakingAssignment)
        {
            if (id != speakingAssignment.SpeakingAssignmentID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(speakingAssignment);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpeakingAssignmentExists(speakingAssignment.SpeakingAssignmentID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                //return RedirectToAction(nameof(Index));
                return(RedirectToAction("Index", "Meetings"));
            }
            ViewData["MeetingID"] = new SelectList(_context.Meetings, "ID", "ID", speakingAssignment.MeetingID);
            ViewData["SpeakerID"] = new SelectList(_context.Speakers, "ID", "ID", speakingAssignment.SpeakerID);
            return(View(speakingAssignment));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(int id, [Bind("PrayerID,MeetingID,PrayerName,Order")] Prayer prayer)
        {
            if (id != prayer.PrayerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(prayer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PrayerExists(prayer.PrayerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(prayer));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,MeetingDate,Presiding,Conducting,IntermediateSong,IntermediateMusicalNumber,Speaker1,Speaker2,Speaker3,Speaker4,Speaker5,Speaker6,Speaker7,OpeningHymn,SacramentHymn,ClosingHymn,OpeningPrayer,ClosingPrayer")] Meetings meetings)
        {
            if (id != meetings.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meetings);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingsExists(meetings.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(meetings));
        }
        public async Task <IActionResult> Edit(int id, [Bind("SpeakerId,SpeakerName,Subject,MeetingId")] Speaker speaker)
        {
            if (id != speaker.SpeakerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(speaker);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpeakerExists(speaker.SpeakerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MeetingId"] = new SelectList(_context.Meetings, "MeetingId", "MeetingId", speaker.MeetingId);
            return(View(speaker));
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("HymnID,HymnNumber,HymnName")] Hymn hymn)
        {
            if (id != hymn.HymnID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hymn);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HymnExists(hymn.HymnID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hymn));
        }
        public async Task <IActionResult> Edit(int id, [Bind("SacramentMeetingPlanID,Date,OpeningPrayer,ClosingPrayer,OpeningHymn,SacramentHymn,ClosingHymn,Talk1,Talk2,Talk3,Topic,LeaderName,Presiding,Announcements")] SacramentMeetingPlan sacramentMeetingPlan)
        {
            if (id != sacramentMeetingPlan.SacramentMeetingPlanID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sacramentMeetingPlan);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SacramentMeetingPlanExists(sacramentMeetingPlan.SacramentMeetingPlanID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sacramentMeetingPlan));
        }
        public async Task <IActionResult> Edit(int id, [Bind("MeetingID,MeetingDate,Conductor")] Meeting meeting)
        {
            if (id != meeting.MeetingID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meeting);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingExists(meeting.MeetingID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
Exemplo n.º 12
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,name,artist,book,bookFilter,collectionFilter,url,alturl,mp3,playerlink,pdf,video1,video2,showAsterisk,hasDownload,midi,songid,songNumber,detailColumn")] MyModel myModel)
        {
            if (id != myModel.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(myModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MyModelExists(myModel.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(myModel));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Salutation,isLeader,Name")] Member member)
        {
            if (id != member.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(member);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MemberExists(member.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(member));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Topic,Minutes")] Speaker speaker)
        {
            if (id != speaker.ID)
            {
                return(NotFound());
            }

            speaker.Member  = GetSelectedMember("MemberSelect");
            speaker.Meeting = GetSelectedMeeting("MeetingSelect");

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(speaker);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpeakerExists(speaker.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(speaker));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,MeetingDate,Conductor,OpeningHymn,OpeningHymnPage,Invocation,SacramentHymn,SacramentHymnPage,IntermediateNumber,ClosingHymn,ClosingHymnPage,Benediction")] Meeting meeting)
        {
            if (id != meeting.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meeting);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingExists(meeting.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
Exemplo n.º 16
0
        public async Task <IActionResult> Edit(int id, [Bind("SpeakerID,MeetingID,PersonID,AssignedTopic")] Speaker speaker)
        {
            if (id != speaker.SpeakerID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(speaker);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpeakerExists(speaker.SpeakerID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(speaker));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] Ward ward)
        {
            if (id != ward.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(ward);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WardExists(ward.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(ward));
        }
Exemplo n.º 18
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Topic")] AssignmentTopic assignmentTopic)
        {
            if (id != assignmentTopic.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(assignmentTopic);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AssignmentTopicExists(assignmentTopic.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(assignmentTopic));
        }
Exemplo n.º 19
0
        public async Task <IActionResult> Edit(int id, [Bind("PersonID,LastName,FirstMidName,Discriminator")] Person person)
        {
            if (id != person.PersonID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(person);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PersonExists(person.PersonID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(person));
        }
Exemplo n.º 20
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,MeetingID,AssignmentTopicID,Name")] Speaker speaker)
        {
            if (id != speaker.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(speaker);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SpeakerExists(speaker.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AssignmentTopicID"] = new SelectList(_context.AssignmentTopics, "ID", "Topic", speaker.AssignmentTopicID);
            ViewData["MeetingID"]         = new SelectList(_context.Meetings, "ID", "MeetingDate", speaker.MeetingID);

            return(View(speaker));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,Date,Conducting,OpeningHymn,Invocation,SacramentHymn,SacramentPrayer,ClosingHymn,Benediction,Speakers")] MeetingView meeting)
        {
            if (id != meeting.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    Meeting newMeeting = new Meeting {
                        ID = meeting.ID, Date = meeting.Date, Conducting = meeting.Conducting, OpeningHymn = meeting.OpeningHymn, Invocation = meeting.Invocation, SacramentHymn = meeting.SacramentHymn, SacramentPrayer = meeting.SacramentPrayer, ClosingHymn = meeting.ClosingHymn, Benediction = meeting.Benediction
                    };

                    _context.Update(newMeeting);
                    await _context.SaveChangesAsync();

                    //Remove Speakers
                    var removeSpeakers = _context.Speakers.Select(s => s).Where(s => s.MeetingID == id);
                    foreach (Speaker s in removeSpeakers)
                    {
                        _context.Remove(s);
                    }
                    await _context.SaveChangesAsync();

                    //Update Speakers
                    foreach (Speaker s in meeting.Speakers)
                    {
                        s.MeetingID = id;
                        _context.Speakers.Add(s);
                    }
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingExists(meeting.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
Exemplo n.º 22
0
    public async Task <TEntity> Update(TEntity entity)
    {
        if (entity == null)
        {
            throw new ArgumentNullException(nameof(entity));
        }

        try
        {
            _dbContext.Update(entity);
            await this.SaveChangesAsync();

            return(entity);
        }
        catch (System.Exception ex)
        {
            throw new Exception($"{nameof(entity)} could not be updated: {ex.Message}");
        }
    }
        public async Task <IActionResult> Edit(int id, [Bind("ID,MeetingDate,Conductor,OpeningHymn,Invocation,SacramentHymn,ClosingHymn,Benediction,Notes")] Meeting meeting)
        {
            if (id != meeting.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meeting);

                    Speaker speaker = new Speaker();
                    speaker.Name = Request.Form["Name"];
                    _context.Add(speaker);

                    SpeakingAssignment topic = new SpeakingAssignment();
                    topic.Topic     = Request.Form["Topic"];
                    topic.MeetingID = meeting.ID;
                    topic.SpeakerID = speaker.ID;
                    _context.Add(topic);

                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingExists(meeting.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ID,MeetingDate,OptionalRestHymnTitle")] Meeting meeting)
        {
            if (id != meeting.ID)
            {
                return(NotFound());
            }

            meeting.Ward = GetSelectedWard("WardSelect");
            meeting.FastAndTestimonyMeeting = (Request.Form["FastMeeting"].Count > 0);
            meeting.Presiding           = GetSelectedMember("PresidingSelect");
            meeting.ConductingLeader    = GetSelectedMember("ConductingSelect");
            meeting.Chorister           = GetSelectedMember("ChoristerSelect");
            meeting.Organist            = GetSelectedMember("OrganistSelect");
            meeting.OpeningHymn         = GetSelectedHymn("OpeningHymnSelect");
            meeting.OpeningPrayerMember = GetSelectedMember("OpeningPrayerSelect");
            if (Request.Form["Announcements"].Count > 0)
            {
                meeting.Announcements = Request.Form["Announcements"][0];
            }
            meeting.SacramentHymn = GetSelectedHymn("SacramentHymnSelect");
            if (Request.Form["RestHymnSelect"].Count > 0)
            {
                meeting.OptionalRestHymnTitle = Request.Form["RestHymnSelect"][0];
            }
            meeting.OptionalRestHymnMember = GetSelectedMember("RestHymnMemberSelect");
            meeting.ClosingHymn            = GetSelectedHymn("ClosingHymnSelect");
            meeting.ClosingPrayerMember    = GetSelectedMember("ClosingPrayerSelect");


            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(meeting);

                    // Remove Speakers
                    var sp = _context.Speakers.Where(obj => obj.Meeting.Equals(meeting));
                    foreach (Speaker element in sp)
                    {
                        Debug.WriteLine("Speaker ID : {0}", element.ID);
                        _context.Speakers.Remove(element);
                    }
                    //await _context.SaveChangesAsync();

                    // Add Speakers
                    int count = Request.Form["SpeakerMember"].Count;
                    for (int i = 0; i < count; i++)
                    {
                        Speaker s = new Speaker
                        {
                            Meeting = meeting,
                            Member  = _context.Members.Find(int.Parse(Request.Form["SpeakerMember"][i])),
                            Topic   = Request.Form["SpeakerTopic"][i],
                            Minutes = int.Parse(Request.Form["SpeakerMinutes"][i]),
                        };
                        _context.Speakers.Add(s);
                    }
                    // End add

                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MeetingExists(meeting.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(meeting));
        }