public async Task LoadEvent()
        {
            var json = await GetJsonByApi("events/" + EventId);

            if (json != null)
            {
                _event = JsonConvert.DeserializeObject <GetEventModel>(json);
                if (_event != null)
                {
                    ActionBar.Title = _event.Title;
                    FindViewById <TextView>(Resource.Id.EventDetail_Desc).Text = _event.Description;
                    FindViewById <TextView>(Resource.Id.EventDetail_Loc).Text  = _event.Location;
                    FindViewById <TextView>(Resource.Id.EventDetail_Date).Text =
                        _event.DateOfOccurance.ToShortDateString();
                    FindViewById <TextView>(Resource.Id.EventDetail_Time).Text =
                        _event.DateOfOccurance.ToShortTimeString();

                    if (_event.IsOwner)
                    {
                        _eventDetailMenu.FindItem(Resource.Id.EventDetailMenu_Edit).SetVisible(true);
                    }

                    var statusItem = _eventDetailMenu.FindItem(Resource.Id.EventDetailMenu_Status);
                    switch (_event.AttendanceStatus)
                    {
                    case 0:
                        statusItem.SetTitle("Going");
                        statusItem.SetIcon(Resource.Drawable.ic_check_circle_white_24dp);
                        statusItem.SetVisible(true);
                        break;

                    case 1:
                        statusItem.SetIcon(Resource.Drawable.ic_cancel_white_24dp);
                        statusItem.SetTitle("Not goind");
                        statusItem.SetVisible(true);
                        break;

                    case 2:
                        statusItem.SetTitle("Going");
                        statusItem.SetIcon(Resource.Drawable.ic_check_circle_white_24dp);
                        statusItem.SetVisible(true);
                        break;

                    case 3:
                        statusItem.SetTitle("Request");
                        statusItem.SetIcon(Resource.Drawable.ic_person_white_24dp);
                        statusItem.SetVisible(true);
                        break;
                    }
                    await GetComments();
                    await GetInvitableUsers();
                }
            }
        }
Beispiel #2
0
        public Event GetEvents(GetEventModel model)
        {
            if (model != null)
            {
                var url = string.IsNullOrEmpty(model.Category) ? "events" : $"categories/{model.Category}";
                url += string.IsNullOrEmpty(model.StatusEvent) ? "" : $"?status={model.StatusEvent}";

                var eventsReturn = this.Get <Event>(url);

                if (!string.IsNullOrEmpty(model.SortByField))
                {
                    eventsReturn.Events = SortEvents(eventsReturn, model.SortByField, model.SortMethod);
                }
                return(eventsReturn);
            }
            else
            {
                return(this.Get <Event>("events"));
            }
        }
Beispiel #3
0
 public IActionResult Index([FromBody] GetEventModel model)
 {
     return(Ok(this.eventService.GetEvents(model)));
 }