示例#1
0
 public void AddDeviceTest()
 {
     BLImplements.DeviceBL dbl = new DeviceBL();
     dbl.AddDevice(new Device {
         IMEI = "", URI = "", OSId = 1, ReceiverNewID = 15232
     });
 }
        // return StatusCodes:
        // UnAuthorised: Invalid receiver Token
        // InternalServerError: Internal error
        public BaseServiceResult AddDevice(long ReceiverId, Device deviceInfo, string ReceiverToken)
        {
            try
            {
                using (IReceiverBL ReceiverBL = new ReceiverBL())
                {
                    if (!ReceiverBL.CheckTokenValid(ReceiverToken, ReceiverId))
                    {
                        return(new BaseServiceResult(ResultStatusCodes.UnAuthorised, null));
                    }
                }

                using (var DeviceBL = new DeviceBL())
                {
                    return(DeviceBL.AddDevice(deviceInfo));
                }
            } catch (Exception ex)
            {
                Logger.Error("AddDevice", ex);
                return(BaseServiceResult.InternalErrorResult);
            }
        }