public async Task <bool> CreateSignalSwitchLog(SignalSwitchRequest request) { var copier = new ClassValueCopier(); SignalSwitch newChildPart = copier.ConvertAndCopy <SignalSwitch, SignalSwitchRequest>(request); return(await _signalSwitchLog.AddAsync(newChildPart)); }
public async Task <ActionResult> CreateSignalSwitch([FromBody] SignalSwitchRequest request) { ActionResponse response; try { bool result = await _businessLogic.CreateSignalSwitchLog(request); response = (result) ? new ActionResponse(StatusCodes.Status200OK) : new ActionResponse(StatusCodes.Status422UnprocessableEntity); } catch (Exception ex) { response = new ActionResponse(StatusCodes.Status500InternalServerError); response.StatusDescription += ex.Message.ToString(); } return(StatusCode(response.StatusCode, response)); }