public IActionResult Post(ServiceViewModel serviceVM) { if (!ModelState.IsValid) { return(BadRequest("Data Not Valid")); } try { if (serviceVM == null) { return(BadRequest("Data cannot null")); } var data = _servicesService.AddService(serviceVM); return(Ok(data)); } catch (Exception ex) { return(BadRequest(ex)); } }
public async Task <IActionResult> AddAdmin([FromBody] ServiceModel service) { var name = await _servicesService.AddService(ServiceMapper.Map(service)); return(Ok(name)); }