public async Task <IActionResult> Post([FromBody] Models.ViewModels.EquipmentTypeModel equipment) { if (equipment == null) { ModelState.AddModelError(nameof(equipment), new ArgumentNullException(nameof(equipment)).ToString()); } if (ModelState.IsValid) { Domain.Models.DB.EquipmentType dbEquipment = new Domain.Models.DB.EquipmentType(equipment.Name); await equipmentTypeService.CreateAsync(dbEquipment); return(Ok()); } return(BadRequest(ModelState)); }
public EquipmentTypeModel(Domain.Models.DB.EquipmentType equipmentType) { this.Id = equipmentType.Id; this.Name = equipmentType.Name; }