public ActionResult <TipoMaterialDTO> CreateTipoMaterial(TipoMaterialForCreationDto tipoMaterialForCreation) { //business logic should be implemented with another layer var tipoMaterial = _mapper.Map <TipoMaterial>(tipoMaterialForCreation); var result = _tipoMaterialData.Add(tipoMaterial); return(Ok(_mapper.Map <TipoMaterialDTO>(result))); }
// To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } var result = _tipoMaterialData.Add(TipoMaterial); await _tipoMaterialData.Commit(); TempData["Message"] = "Se ha creado un nuevo tipo de material"; return(RedirectToPage("./Details", new { id = result.ID })); }