public static JurisdictionInfrastructure Create() { Jurisdiction model = new Jurisdiction(); JurisdictionViewModel viewModel = new JurisdictionViewModel(model); JurisdictionView view = new JurisdictionView(viewModel); return(new JurisdictionInfrastructure(model, viewModel, view)); }
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)); }
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)); }
public JurisdictionInfrastructure(Jurisdiction model, JurisdictionViewModel viewModel, JurisdictionView view) { Model = model; ViewModel = viewModel; View = view; }
public MainWindow(JurisdictionViewModel viewModel) { InitializeComponent(); }