public TResponse UpdateStatus(int ID, bool Status)
        {
            using (var db = new UnitOfWork())
            {
                try
                {
                    DroneEquipment objDroneEquipment = db.DroneEquipmentRepository.GetById(ID);
                    if (objDroneEquipment != null && objDroneEquipment.ID > 0)
                    {
                        objDroneEquipment.IsActive = Status;
                        db.DroneEquipmentRepository.Update(objDroneEquipment);
                    }
                    objTResponse.Status  = ResponseStaus.ok;
                    objTResponse.Message = ResponseMessage.success;
                }
                catch (Exception ex)
                {
                    ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
                    objerrorlog.AddErrorLog(new ErrorLogModel {
                        MethodName = "DeleteDroneEquipment", Id = 0, ClassName = "DroneEquipmentBusiness", Error = ex.Message
                    });
                    return(objTResponse);
                }

                return(objTResponse);
            }
        }
 public TResponse GetByID(long Id)
 {
     using (var db = new UnitOfWork())
     {
         try
         {
             DroneEquipmentModel objDroneEquipmentModel = new DroneEquipmentModel();
             DroneEquipment      objDroneEquipment      = db.DroneEquipmentRepository.Get(x => x.ID == Id).FirstOrDefault();
             if (objDroneEquipment != null)
             {
                 objDroneEquipmentModel              = new DroneEquipmentModel();
                 objDroneEquipmentModel.ID           = objDroneEquipment.ID;
                 objDroneEquipmentModel.Model        = objDroneEquipment.Model;
                 objDroneEquipmentModel.SerialNumber = objDroneEquipment.SerialNumber;
                 objDroneEquipmentModel.IsActive     = Convert.ToBoolean(objDroneEquipment.IsActive);
                 objDroneEquipmentModel.IsDeleted    = Convert.ToBoolean(objDroneEquipment.IsDeleted);
                 objDroneEquipmentModel.CreatedOn    = Convert.ToDateTime(objDroneEquipment.CreatedOn);
                 objTResponse.Status         = ResponseStaus.ok;
                 objTResponse.Message        = ResponseMessage.success;
                 objTResponse.ResponsePacket = objDroneEquipmentModel;
             }
             else
             {
                 objTResponse.Status         = ResponseStaus.error;
                 objTResponse.Message        = ResponseMessage.ItemNotFound;
                 objTResponse.ResponsePacket = null;
             }
             return(objTResponse);
         }
         catch (DbEntityValidationException dbEx)
         {
             ErrorLogBusiness objerrorlog = new ErrorLogBusiness();
             objerrorlog.AddErrorLog(new ErrorLogModel {
                 MethodName = "GetByID", Id = Id, ClassName = "DroneEquipmentBusiness", Error = dbEx.Message
             });
             return(objTResponse);
         }
     }
 }