public async Task <IActionResult> GetDeviceDetailBySerialNumber(string slnumber) { var service = new DeviceRepositoryService(connString); var result = await service.GetAllDetailDeviceBySerialNumber(slnumber); var response = new GenericResponse <DeviceDetails>() { IsSuccess = true, Message = "Data fetched successfully.", ResponseCode = 200, Result = result }; return(Ok(response)); }
public async Task <IActionResult> Put(int id, DeviceUserAssociationUpdateModel model) { var service = new DeviceRepositoryService(connString); await service.UpdateDeviceUserAssociation(id, model.UserId, "user1", model.Stratdate); var response = new GenericResponse <string>() { IsSuccess = true, Message = "DeviceAssociation updated successfully.", ResponseCode = 200, Result = "Success" }; return(Ok(response)); }
public async Task <IActionResult> GetDeviceByInstitute(int id) { var service = new DeviceRepositoryService(connString); var result = await service.GetAllDetailDeviceByInstitute(id); var response = new GenericResponse <List <DeviceExtended> >() { IsSuccess = true, Message = "Data fetched successfully.", ResponseCode = 200, Result = result }; return(Ok(response)); }
public async Task <IActionResult> Put(int id, DeviceUpdateModel model) { var service = new DeviceRepositoryService(connString); await service.UpdateDevice(id, model.Model, model.Version, model.SerialNumber, model.Description, "user1"); var response = new GenericResponse <string>() { IsSuccess = true, Message = "Device updated successfully.", ResponseCode = 200, Result = "Success" }; return(Ok(response)); }
public async Task <IActionResult> Create(DeviceModel model) { var service = new DeviceRepositoryService(connString); await service.CreateDevice(model.ModelName, model.Version, model.SerialNumber, model.Description, "User1", model.UserId, model.Stratdate, model.InstituteId); var response = new GenericResponse <string>() { IsSuccess = true, Message = "Device created successfully.", ResponseCode = 200, Result = "Success" }; return(Ok(response)); }
public async Task <IActionResult> Delete(int id) { var username = ApplicationUtility.GetTokenAttribute(Request.Headers["Authorization"], "sub"); var service = new DeviceRepositoryService(connString); await service.DeleteDevice(id, username); var response = new GenericResponse <string>() { IsSuccess = true, Message = "Device deleted successfully.", ResponseCode = 200, Result = "Success" }; return(Ok(response)); }
public async Task <IActionResult> DeviceExist(string slnumber) { var service = new DeviceRepositoryService(connString); var res = await service.GetAllDetailDeviceBySerialNumber(slnumber); bool result = false; if (res != null) { result = true; } var response = new GenericResponse <bool>() { IsSuccess = true, Message = "Data fetched successfully.", ResponseCode = 200, Result = result }; return(Ok(response)); }