public async Task <IActionResult> MachineRegistration([FromBody] MachineRegistrationModel obj) { if (ModelState.IsValid) { return(Ok(await _pumpService.MachineRegistration(obj))); } else { return(UnprocessableEntity()); } }
public async Task <int> MachineRegistration(MachineRegistrationModel obj) { try { var sp = PetroConnect.API.Helpers.StringGenerator.GetProcedureParameter(obj, SPConstants.spSetMachineRegistration); var result = await _connectContext.spSetMachineRegistration.FromSqlRaw(sp, obj.Action, obj.MCN_Id, obj.MCN_UID_UserId, obj.MCN_Name, obj.MCN_IsActive).ToListAsync(); return(result.FirstOrDefault().Result); } catch (Exception ex) { _ILogger.Log(LogLevel.Critical, "Exception while calling SpRegistrationTeam ", ex); return(0); } }