コード例 #1
0
        public Response Accept(int id, string message)
        {
            var accept = new MeetingAccept() { meetingId = id, acceptorId = GetUserId(), message = message };
            var meetingRep = new MeetingRepository();
            var meeting = meetingRep.Meetings.FirstOrDefault(x => x.Id == accept.meetingId);
            if (meeting == null)
            {
                return new BadRequestError("No such meeting");
            }
            meeting.checkPermissions(GetUserId());
            if (meeting.isOwner)
            {
                return new UnauthorizedError("Not for owner");
            }
            if (meeting.IsAccepter)
            {
                return new BadRequestError("Already accepted");
            }
            if (meeting.confirmer != null)
            {
                return new BadRequestError("Already confirmed");
            }

            int acceptId = meetingRep.Create(accept);
            if (acceptId > 0)
            {
                return Response(acceptId);
            }

            return new InternalError();
        }
コード例 #2
0
        public int Create(MeetingAccept accept)
        {
            if (accept.Id == 0)
            {

                    context.MeetingAccepts.InsertOnSubmit(accept);
                    SubmitChanges();

                    Service.Notify.NewAccept(accept);
                    return accept.Id;

            }
            return -1;
        }
コード例 #3
0
 public static MeetingAcceptApiModel Map(MeetingAccept accept)
 {
     return new MeetingAcceptApiModel()
     {
         id = accept.Id.ToString(),
         acceptor = new UserApiModel()
         {
             id = accept.AspNetUser.Id,
             username = accept.AspNetUser.UserName,
             photo = accept.AspNetUser.photo
         },
         confirmed = accept.confirmed,
         meetingId = accept.meetingId.ToString(),
         message = accept.message,
         time = accept.time
     };
 }
コード例 #4
0
        public ActionResult Accept(MeetingAccept accept)
        {
            var meetingRep = new MeetingRepository();
            var meeting = meetingRep.Meetings.FirstOrDefault(x => x.Id == accept.meetingId);
            if (meeting == null)
            {
                throw new Exception();
            }
            if (meeting.confirmer != null)
            {
                throw new Exception();
            }

            int id = meetingRep.Create(accept);
            if (id > 0)
            {

                Notify.NewAccept(accept);
                return View(true);
            }

            throw new Exception();
        }
コード例 #5
0
		private void detach_MeetingAccepts(MeetingAccept entity)
		{
			this.SendPropertyChanging();
			entity.Meeting = null;
		}
コード例 #6
0
		private void attach_MeetingAccepts(MeetingAccept entity)
		{
			this.SendPropertyChanging();
			entity.Meeting = this;
		}
コード例 #7
0
 partial void DeleteMeetingAccept(MeetingAccept instance);
コード例 #8
0
 partial void UpdateMeetingAccept(MeetingAccept instance);
コード例 #9
0
 partial void InsertMeetingAccept(MeetingAccept instance);