public IHttpActionResult Backend_Detail_New()
        {
            BackendEventViewModel   viewmodel         = new BackendEventViewModel();
            EventDataController     dataCtrl          = new EventDataController();
            EventTypeDataController eventTypeDataCtrl = new EventTypeDataController();

            try
            {
                viewmodel.EventTypeOptions = eventTypeDataCtrl.GetItems().ToList().ConvertAll(x =>
                {
                    return(new BackendEventTypeViewModelItem()
                    {
                        ID = x.ID, Name = x.Name
                    });
                }).OrderByDescending(x => x.ID).ToList();
                viewmodel.Data.Start = DateTime.Now;
                viewmodel.Data.End   = DateTime.Now;
            }
            catch (Exception ex)
            {
                return(Error(viewmodel, ex));
            }

            return(Ok(viewmodel));
        }
Beispiel #2
0
        public IHttpActionResult Backend_Detail(Int32 id)
        {
            BackendEventTypeViewModel viewmodel = new BackendEventTypeViewModel();
            EventTypeDataController   dataCtrl  = new EventTypeDataController();

            try
            {
                viewmodel.Data.FromModel(dataCtrl.GetItem(id));
            }
            catch (Exception ex)
            {
                return(Error(viewmodel, ex));
            }

            return(Ok(viewmodel));
        }
Beispiel #3
0
        public IHttpActionResult Backend_Detail_Update(Int32 id, BackendEventTypeViewModelItem request)
        {
            BackendEventTypeViewModel viewmodel = new BackendEventTypeViewModel();
            EventTypeDataController   dataCtrl  = new EventTypeDataController();

            try
            {
                var result = dataCtrl.Update(request.ToModel());
                viewmodel.Data.FromModel(result);
            }
            catch (Exception ex)
            {
                return(Error(viewmodel, ex));
            }

            return(Ok(viewmodel, "Der Eintrag wurde gespeichert."));
        }
Beispiel #4
0
        public IHttpActionResult Backend_Get()
        {
            BackendEventTypeListViewModel viewmodel = new BackendEventTypeListViewModel();
            BackendEventTypeListArgs      args      = new BackendEventTypeListArgs();
            EventTypeDataController       dataCtrl  = new EventTypeDataController();

            try
            {
                Int32 TotalItemsCount;
                viewmodel.Data.FromModel(dataCtrl.FilterList(args, out TotalItemsCount));

                viewmodel.Pagination.TotalItemsCount = TotalItemsCount;
            }
            catch (Exception ex)
            {
                return(Error(viewmodel, ex));
            }

            return(Ok(viewmodel));
        }