コード例 #1
0
        public static JurisdictionInfrastructure Create()
        {
            Jurisdiction          model     = new Jurisdiction();
            JurisdictionViewModel viewModel = new JurisdictionViewModel(model);
            JurisdictionView      view      = new JurisdictionView(viewModel);

            return(new JurisdictionInfrastructure(model, viewModel, view));
        }
コード例 #2
0
        public object Post([FromBody] JurisdictionViewModel model)
        {
            if (model == null)
            {
                return(BadRequest("No Jurisdiction to add"));
            }

            var jurisdiction = new Jurisdiction()
            {
                Name         = model.Name,
                Abbreviation = model.Abbreviation
            };

            _unitOfWork.Jurisdictions.Add(jurisdiction);

            _unitOfWork.Complete();

            return(Ok(jurisdiction));
        }
コード例 #3
0
        public object Put([FromBody] JurisdictionViewModel model)
        {
            if (model == null)
            {
                return(BadRequest("No Jurisdiction to update"));
            }

            var jurisdiction = _unitOfWork.Jurisdictions.GetById(model.Id);

            if (jurisdiction == null)
            {
                return(NotFound("Jurisdiction not found"));
            }

            jurisdiction.Name         = model.Name;
            jurisdiction.Abbreviation = model.Abbreviation;

            _unitOfWork.Complete();
            return(Ok(jurisdiction));
        }
コード例 #4
0
 public JurisdictionInfrastructure(Jurisdiction model, JurisdictionViewModel viewModel, JurisdictionView view)
 {
     Model     = model;
     ViewModel = viewModel;
     View      = view;
 }
コード例 #5
0
 public MainWindow(JurisdictionViewModel viewModel)
 {
     InitializeComponent();
 }