コード例 #1
0
 public int Create(Meeting instance)
 {
     if (instance.Id == 0)
     {
         context.Meetings.InsertOnSubmit(instance);
         SubmitChanges();
         Service.Notify.NewMeeting(instance);
         return instance.Id;
     }
     return -1;
 }
コード例 #2
0
 public static MeetingApiModel Map(Meeting model)
 {
     return new MeetingApiModel()
     {
         id = model.Id.ToString(),
         description = model.description,
         latitude = model.latitude,
         longitude = model.longitude,
         time = model.time,
         owner = Map(model.Owner),
         accept = model.IsAccepter? Map(model.CurrentUserAccept): null,
         acceptsCount = model.MeetingAccepts.Count,
         confirmer = model.confirmer == null ? null : Map(model.Confirmer)
     };
 }
コード例 #3
0
 partial void DeleteMeeting(Meeting instance);
コード例 #4
0
 partial void UpdateMeeting(Meeting instance);
コード例 #5
0
 partial void InsertMeeting(Meeting instance);
コード例 #6
0
		private void detach_Meetings1(Meeting entity)
		{
			this.SendPropertyChanging();
			entity.AspNetUser1 = null;
		}
コード例 #7
0
		private void attach_Meetings(Meeting entity)
		{
			this.SendPropertyChanging();
			entity.AspNetUser = this;
		}
コード例 #8
0
        public Response Create(float latitude, float longitude, int time, string description)
        {
            var meeting = new Meeting()
            {
                latitude = latitude.ToString(),
                longitude = longitude.ToString(),
                time = time,
                description = description
            };
            if (ModelState.IsValid)
            {
                int id = -1;
                var userId = GetUserId();
                meeting.creator = userId;
                var meetingRep = new MeetingRepository();

                id = meetingRep.Create(meeting);
                if (id > -1)
                {
                    Notify.NewMeeting(meeting);
                    return Response(new { id = id });
                }
            }
            else
            {
                return new BadRequestError();
            }
            return new InternalError();
        }