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)); }
public IHttpActionResult Backend_Detail_Update(Int32 id, BackendEventViewModelItem request) { BackendEventViewModel viewmodel = new BackendEventViewModel(); EventDataController dataCtrl = new EventDataController(); try { dataCtrl.Update(request.ToModel()); } catch (Exception ex) { return(Error(viewmodel, ex)); } return(Ok(viewmodel, "Eintrag wurde gespeichert.")); }
public IHttpActionResult Backend_Detail_Insert(BackendEventViewModelItem request) { BackendEventViewModel viewmodel = new BackendEventViewModel(); EventDataController dataCtrl = new EventDataController(); try { var data = dataCtrl.Insert(request.ToModel()); viewmodel.Data.FromModel(data); } catch (Exception ex) { return(Error(viewmodel, ex)); } return(Ok(viewmodel, "Eintrag wurde gespeichert.")); }