Esempio n. 1
0
        public async ValueTask <IActionResult> Post([FromBody] DeaneryViewModel model)
        {
            if (ModelState.IsValid)
            {
                Deanery deanery = model.Convert <DeaneryViewModel, Deanery>(_mapper);
                (bool succeeded, Deanery addedDeanery, string error) = await _repo.Add(deanery);

                if (succeeded)
                {
                    return(await Get(addedDeanery.Id));
                }
                return(BadRequest(new { Message = error }));
            }
            return(BadRequest(new { Errors = ModelState.Values.SelectMany(e => e.Errors).ToList() }));
        }
Esempio n. 2
0
 public DeaneryPage()
 {
     InitializeComponent();
     BindingContext = viewModel = new DeaneryViewModel();
 }