Esempio n. 1
0
        public IHttpActionResult Backend_Detail_Insert(BackendPartnerViewModelItem request)
        {
            BackendPartnerViewModel viewmodel = new BackendPartnerViewModel();
            PartnerDataController   dataCtrl  = new PartnerDataController();

            try
            {
                viewmodel.Data.FromModel(dataCtrl.Insert(request.ToModel()));
            }
            catch (Exception ex)
            {
                return(Error(viewmodel, ex));
            }

            return(Ok(viewmodel, "Partner wurde erstellt."));
        }
Esempio n. 2
0
        public IHttpActionResult Backend_Detail_Update(Int32 id, BackendPartnerViewModelItem request)
        {
            BackendPartnerViewModel viewmodel = new BackendPartnerViewModel();
            PartnerDataController   dataCtrl  = new PartnerDataController();
            PartnerDisplayRelationDataController displayRelationDataCtrl = new PartnerDisplayRelationDataController();

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

            return(Ok(viewmodel, "Partner wurde erfolgreich aktualisiert."));
        }